Powershell ISE: Trying to execute a file.cmd to run:

277 views Asked by At

I'm new to powershell and I wanted to run a cmd file from powershell ise to start the file.cmd but I can't get the actual file to start running

I'm trying to call my file.cmd to run. This is somethings I have tried to call it but it does not run the file.cmd from my powershell script. Is there something I'm missing or wrong?

Code:

$fileLocalPath = "c:\Temp\Dash\file.cmd"
Start-Process cmd.exe -ArgumentFile '.c\' $fileLocalPath -Wait
Write-Host "Command has run successfully"

if($LASTCODEEXIT -eq 0){
  Write-Host "File Ran Successfully"
} 
else {
  Write-Host "Failed to run"
}
0

There are 0 answers