$for_list_pc | Foreach-Object { $_ | Start-ThreadJob -ThrottleLimit 500 -ScriptBlock {
" This is input - " + $input
} } |
Wait-Job | Receive-Job
This is input - 1
This is input - 2
This is input - 3
This is input - 4
This is input - 5
This is input - 36
PS D:\> $for_list_pc= 1,2,3,4,5,36
PS D:\> $for_list_pc | Start-ThreadJob -ThrottleLimit 500 -ScriptBlock {
>> "Stream here:"; gm -input $input
>> foreach($i in $input) { " This is input - " + $i }
>> } |
>> Wait-Job | Receive-Job
Stream here:
TypeName: System.Management.Automation.Runspaces.PipelineReader`1+<GetReadEnumerator>d__20[[System.Object, mscorlib, Version=4.0.0.0, Cu
lture=neutral, PublicKeyToken=b77a5c561934e089]]
Name MemberType Definition
---- ---------- ----------
Dispose Method void IDisposable.Dispose()
Equals Method bool Equals(System.Object obj)
GetHashCode Method int GetHashCode()
GetType Method type GetType()
MoveNext Method bool IEnumerator.MoveNext()
Reset Method void IEnumerator.Reset()
ToString Method string ToString()
<>4__this Property System.Management.Automation.Runspaces.PipelineReader[System.Object] <>4__this {get;set;}
Current Property System.Object Current {get;}
This is input - 1
This is input - 2
This is input - 3
This is input - 4
This is input - 5
This is input - 36
PS D:\> Start-ThreadJob -ThrottleLimit 500 -ScriptBlock {
>> foreach($i in $using:for_list_pc) { "This is input - " + $i }
>> } |
>> Wait-Job | Receive-Job
This is input - 1
This is input - 2
This is input - 3
This is input - 4
This is input - 5
This is input - 36
$chromeDriver.executeScript('window.navigator.geolocation.getCurrentPosition =
function(success){
var position = {"coords" : {
"latitude": "555",
"longitude": "999"
}
};
success(position);}')
internal static StreamReader OpenStreamReader(PSCmdlet command, string filePath, string encoding, bool isLiteralPath)
{
FileStream fileStream = PathUtils.OpenFileStream(filePath, command, isLiteralPath);
if (encoding == null)
return new StreamReader((Stream) fileStream);
return new StreamReader((Stream) fileStream, EncodingConversion.Convert((Cmdlet) command, encoding));
}
private void CreateFileStream()
{
//…..
if (this.isActuallyAppending)
{
/…
}
else
PathUtils.MasterStreamOpen((PSCmdlet) this, this.Path, this._encodingParameter ?? "ASCII", false, (bool) this.Append, (bool) this.Force, (bool) this.NoClobber, out this._fs, out this._sw, out this.readOnlyFileInfo, this.isLiteralPath);
}
p.s. а скачать архивчик модуля для установки offline можно через Save-Module на машине с инетом и рабочим PSv5.1