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:
- 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:
- Get-ChildItem:Cannot find path 'D:\Tasks\ûpath' because it does not exist.
- At line:1char:14
- +Get-ChildItem<<<<ûpath ô\\AS_Server\Bu.txtö|Forea
- ch-Object{(Get-Content $_)|Out-String|Foreach-Object{$_.Replace('Status=ON','Status=OFF')}|Set-Content $_}
- +CategoryInfo:ObjectNotFound:(D:\Tasks\ûpath:String)[Get-ChildItem],ItemNotFoundException
- +FullyQualifiedErrorId:PathNotFound,Microsoft.PowerShell.Commands.GetChildItemCommand