我正在尝试从PowerShell 3 ISE运行此命令:
&"C:\inetpub\htpasswd.exe -bc C:\inetpub\wwwroot\xyz\password\passMD5.txt sm88555 sm88999"
但是得到这个错误:
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.
我认为PowerShell在第一个空格后会停止正确评估此值?
最佳答案
iex
-当&失败时使用的Invoke-Expression
$htPassword = "C:\inetpub\htpasswd.exe"
$htParams = "C:\inetpub\wwwroot\xyz\password\passMD5.txt sm88555 sm88999"
Invoke-Expression -Command "$htPassword $htParams"
myeval通过joel-b-fant很好地处理了这两个问题
关于powershell - 运行可执行文件的语法?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33979643/