1

我想在 microsoft management studio 中执行一个 powershell 脚本。但我得到一个错误。查看下面的更多详细信息:

EXEC master..xp_cmdshell '%SYSTEMROOT%\System32\WindowsPowerShell\v1.0\powershell.exe -ExecutionPolicy unrestricted -command "C:\tmp_es\test.ps1"'

C:\tmp_es\test.ps1 : The term 'C:\tmp_es\test.ps1' is not recognized as the 
name of a cmdlet, function, script file, or operable program. Check the 
spelling of the name, or if a path was included, verify that the path is 
correct and try again.
4

1 回答 1

1

更改-Command-File

EXEC master..xp_cmdshell '%SYSTEMROOT%\System32\WindowsPowerShell\v1.0\powershell.exe -ExecutionPolicy unrestricted -File "C:\tmp_es\test.ps1"'
于 2016-06-20T12:18:06.367 回答