Calling powershell cmdlets from Windows batch file

后端 未结 6 1144
青春惊慌失措
青春惊慌失措 2020-12-08 21:14

Ok something so simple is just not working for me. I got a cmdlet that accepts a single parameter. I am trying to call a cmdlet within a Windows batch file. The batch fil

6条回答
  •  隐瞒了意图╮
    2020-12-08 21:53

    Try this syntax instead:

    cd %SystemRoot%\system32\WindowsPowerShell\v1.0
    powershell {Set-ExecutionPolicy Unrestricted}
    powershell "& C:\convert-utf8-to-utf16.ps1 C:\test.txt"
    powershell {Set-ExecutionPolicy Restricted}
    pause
    

提交回复
热议问题