Folgenden Powershell Befehl in Batch ausführen geht nicht
Hey Leute, hat einer eine Idee, warum der Befehl:
innerhalb von Powershell problemlos funktioniert, aber wenn ich ihn in einer Batch ausführen möchte, geht es nicht:
Get-ChildItem 'd:\ordner' -File -Filter *.lnk | select -First 10 | Get-Random -Count 10 | %{Start-Process $_.Fullname}
powershell -ExecutionPolicy ByPass -Command "Get-ChildItem 'd:\ordner' -File -Filter *.lnk | select -First 10 | Get-Random -Count 10 | %{Start-Process $_.Fullname}"
Please also mark the comments that contributed to the solution of the article
Content-Key: 61107297113
Url: https://administrator.de/contentid/61107297113
Printed on: June 21, 2024 at 06:06 o'clock
3 Comments
Latest comment
Tipp: Prozentzeichen bezeichnen Variablen in Batch....
Batch Escape Characters
Oder halt kein Alias nehmen
powershell -ExecutionPolicy ByPass -Command "Get-ChildItem 'd:\ordner' -File -Filter *.lnk | select -First 10 | Get-Random -Count 10 | %%{Start-Process $_.Fullname}"
Oder halt kein Alias nehmen
powershell -ExecutionPolicy ByPass -Command "Get-ChildItem 'd:\ordner' -File -Filter *.lnk | select -First 10 | Get-Random -Count 10 | foreach-object {Start-Process $_.Fullname}"