Quantcast
Channel: The Official Scripting Guys Forum! forum
Viewing all articles
Browse latest Browse all 15028

Running a CMD.exe from PowerShell with arguments

$
0
0

Hello guys, I am working with a driver backup program that I need to automate. I am using Power shell to run a few other tasks, like check the OS version and create a folder based on the system type for drivers. We deploy many different devices and needed a way to automate. That is neither here nor there. Here is what I am trying to run, but the CMD, will not seem to pick up the arguments. If I run from the CMD prompt, it will run as expected, but when I lick it off with Power shell, I get a few errors. 

Here is what I have:

$command = @'
cmd.exe /C C:\DriverBU\DrvBK.exe MODE="BACKUP" BKPATH="C:\TempDrivers" BKDESC="Drivers" BKFILE="Backup %NOW%  %COMPUTERNAME%.bki" BKPATHFTM="%COMPUTERNAME%" BKDEVFMT="%DEVNAME%" BKDATEFMT="" OPT="HW"
'@

Invoke-Expression -Command:$command


This will open the program, however, will not run the arguments.

Thoughts?

Thank you!

Paul


Duramaxster


Viewing all articles
Browse latest Browse all 15028

Trending Articles