Reputation: 129
At the end of a powershell script, i wanted to starta cmd script.
In order to proceed, i added this : Invoke-Command cmd /c $destinationn\02_creation_de_repertoire.cmd
Result :
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
Any clue ? I started ./FILE.cmd, or FILE.cmd from powershell, and it work. But in the script, it don't.
Upvotes: 0
Views: 339
Reputation: 8346
Maybe you can use Start-Process -FilePath $destinationn\02_creation_de_repertoire.cmd
instead. Try help Start-Process
from your command prompt for full syntax.
Upvotes: 0
Reputation: 1660
The cmdlet excepts a script block:
Invoke-Command { cmd /c $destinationn\02_creation_de_repertoire.cmd }
Or explicitly:
Invoke-Command -ScriptBlock { cmd /c $destinationn\02_creation_de_repertoire.cmd }
Upvotes: 1