繁体   English   中英

使用参数运行PowerShell脚本

[英]Running PowerShell script with arguments

我一直在尝试使用CMD运行PowerShell脚本,但没有成功。

我正在运行的脚本:

C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe -command 'C:\Program Files\Tivoli\TSM\start-tdpsql-instance.ps1' -dpsqloptfile h:\tsm\dsm.opt -dpsqlcfgfile h:\tsm\tdpsql.cfg

但不幸的是,我收到一条错误消息:

You must provide a value expression on the right-hand side of the '-' operator.
At line:1 char:58
+ 'C:\Program Files\Tivoli\TSM\start-tdpsql-instance.ps1' - <<<< dpsqloptfile h
:\tsm\dsm.opt -dpsqlcfgfile h:\tsm\tdpsql.cfg
+ CategoryInfo          : ParserError: (:) [], ParentContainsErrorRecordEx
ception
+ FullyQualifiedErrorId : ExpectedValueExpression

您有什么想法为什么它不处理我的论点?

我解决了! =]

C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe -Command "& 'C:\Program Files\Tivoli\TSM\start-tdpsql-instance.ps1' -dpsqloptfile 'h:\tsm\dsm.opt' -dpsqlcfgfile 'h:\tsm\tdpsql.cfg'

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM