2015-11-29 184 views
1

我试图从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中停止第一空间之后正确评估呢?

+0

IEX - 调用-表达[-Command] [] – lloyd

回答

2

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

2

呼叫运营商不解释整个COMMANDLINES /表达式可以处理得很好我使用。这就是Invoke-Expression的用途。从命令中分离的参数(并且彼此),如果你想使用的呼叫操作:

& "C:\inetpub\htpasswd.exe" -bc "C:\inetpub\wwwroot\xyz\password\passMD5.txt" "sm88555" "sm88999"