Brian
asked on
How do I run a command line if statement in a PowerShell script
I have the following PowerShell command that is working...
How can I run this command in PowerShell? In a batch file, it would look like this...
& "C:\Program Files\MyProgram\MyCMDprogram.exe" -Enable 7584345
But I want to test for the computer name. If I add an if statement like this...& if %computername%==xyz123 "C:\Program Files\MyProgram\MyCMDprogram.exe" -Enable 75843456
It fails saying that "The term 'if' is not recognized..."How can I run this command in PowerShell? In a batch file, it would look like this...
if %computername%==xyz123 "C:\Program Files\MyProgram\MyCMDprogram.exe" -Enable 75843456
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Cheers !
Shaba