Quantcast
Viewing all articles
Browse latest Browse all 2314

Powershell verläuft sich in Batch

powershell -noprofile -command $Profilepath="\\AS_Server\Bu.txt" powershell -noprofile -command "Get-Content $Profilepath | Foreach-Object {(Get-Content $_) | Out-String | Foreach-Object {$_.Replace('Status=OFF','Status=OFF')} | Set-Content $_}"


Get-Content : Cannot bind argument to parameter 'Path' because it is null.
At line:1 char:12+ Get-Content <<<<  $Profilepath | Foreach-Object {(Get-Content $_) | Out-String | Foreach-Object {$_.Replace('Status=OFF','Status=OFF')} | Set-Content $_}    + CategoryInfo          : InvalidData: (:) [Get-Content], ParameterBindingValidationException    + FullyQualifiedErrorId : ParameterArgumentValidationErrorNullNotAllowed,Microsoft.PowerShell.Commands.GetContentCommand

Das war der erste versuch, der andere sah so aus:

Code:
  1. powershell -noprofile -command "Get-ChildItem –path “\\AS_Server\Bu.txt” | Foreach-Object {(Get-Content $_) | Out-String | Foreach-Object {$_.Replace('Status=ON','Status=OFF')} | Set-Content $_}"

lasse ich das über batch laufen kommt das:
Code:
  1. Get-ChildItem:Cannot find path 'D:\Tasks\ûpath' because it does not exist.
  2. At line:1char:14
  3. +Get-ChildItem<<<<ûpath ô\\AS_Server\Bu.txtö|Forea
  4. ch-Object{(Get-Content $_)|Out-String|Foreach-Object{$_.Replace('Status=ON','Status=OFF')}|Set-Content $_}
  5. +CategoryInfo:ObjectNotFound:(D:\Tasks\ûpath:String)[Get-ChildItem],ItemNotFoundException
  6. +FullyQualifiedErrorId:PathNotFound,Microsoft.PowerShell.Commands.GetChildItemCommand
in der ps console geht es wenn ich "powershell -noprofile -command " weglasse. was ist läuft da schief?


Viewing all articles
Browse latest Browse all 2314


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>