簡體   English   中英

Powershell中的cmd腳本

[英]cmd script from powershell

在powershell腳本的結尾,我想啟動一個cmd腳本。 為了繼續,我添加了以下內容: Invoke-Command cmd /c $destinationn\\02_creation_de_repertoire.cmd

結果:

Invoke-Command : Impossible de trouver un paramètre positionnel acceptant l'argument «
C:\Users\moamg\Desktop\SPO\02_creation_de_repertoire.cmd».
Au caractère C:\Users\moamg\Desktop\scripts_global\01_install_spo1.ps1:32 : 1
+ Invoke-Command cmd /c $destinationn\02_creation_de_repertoire.cmd
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidArgument : (:) [Invoke-Command], ParameterBindingExcept
   ion
    + FullyQualifiedErrorId : PositionalParameterNotFound,Microsoft.PowerShell.Commands.Invo
   keCommandCommand

有什么線索嗎? 我從powershell啟動了./FILE.cmd或FILE.cmd,它可以工作。 但是在腳本中卻沒有。

該cmdlet除外腳本塊:

Invoke-Command { cmd /c $destinationn\02_creation_de_repertoire.cmd }

或明確地:

Invoke-Command -ScriptBlock { cmd /c $destinationn\02_creation_de_repertoire.cmd }

也許您可以使用Start-Process -FilePath $destinationn\\02_creation_de_repertoire.cmd 在命令提示符下嘗試help Start-Process以獲得完整語法。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM