簡體   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