cmdline to Powershell script

Can someone help me convert the command line below to a powershell script?

 

setup.exe /silent ISFeatureInstall=Licensing,PlantDesign,PID,Isometric,Isogen,Piping,PCFExport,PDM,PDMUpdate INSTALLDIR=“C:\Program Files (x86)\Cad-Partner” SMAPLANGUAGE=2 SMAPUNITS=2 SMAPCONFIGFOLDER=“C:\Smap3D_PlantDesign” PIDDATAFOLDER=“C:\Smap3D P&ID” SERVERNAME=“Server01” LICENSINGPORT=16001 INSTALLTOOLBARS=“true” ISDEFAULTDATAINSTALL=“true” INSTALLSTANDARDPARTS=“true” /LOG:C:\Windows\Temp\Install_CAD.log

 

This should get you started:

How to run an EXE file in PowerShell with parameters with spaces and quotes

PowerShell: Running Executables

Have you tried running it as is? You may have to wrap properties with a space in two sets of quotes.

INSTALLDIR='"C:\Program Files (x86)\Cad-Partner"' PIDDATAFOLDER='"C:\Smap3D P&ID"'

Oh cool. There’s a “stop parsing symbol” --% introduced in PS 3. It even changes the syntax colors. https://stackoverflow.com/questions/44498335/command-line-arguments-for-msiexec-break-on-powershell-if-they-contain-space I wish every powershell detail was listed in one place lol.

./setup.exe --% INSTALLDIR="C:\Program Files (x86)\Cad-Partner" PIDDATAFOLDER="C:\Smap3D P&ID"

echo hi | find --% "hi"

[pre]Start-Process “setup.exe” -ArgumentList ‘/silent ISFeatureInstall=Licensing,PlantDesign,PID,Isometric,Isogen,Piping,PCFExport,PDM,PDMUpdate INSTALLDIR=“C:\Program Files (x86)\Cad-Partner” SMAPLANGUAGE=2 SMAPUNITS=2 SMAPCONFIGFOLDER=“C:\Smap3D_PlantDesign” PIDDATAFOLDER=“C:\Smap3D P&ID” SERVERNAME=“Server01” LICENSINGPORT=16001 INSTALLTOOLBARS=“true” ISDEFAULTDATAINSTALL=“true” INSTALLSTANDARDPARTS=“true” /LOG:C:\Windows\Temp\Install_CAD.log’[/pre]

Personally, I like to break up arguments:

Start-Process -FilePath "setup.exe" -NoNewWindow -Wait -ArgumentList @(
    '/silent ISFeatureInstall=Licensing,PlantDesign,PID,Isometric,Isogen,Piping,PCFExport,PDM,PDMUpdate'
    'INSTALLDIR="C:\Program Files (x86)\Cad-Partner"'
    'SMAPLANGUAGE=2'
    'SMAPUNITS=2'
    'SMAPCONFIGFOLDER="C:\Smap3D_PlantDesign"'
    'PIDDATAFOLDER="C:\Smap3D P&ID"'
    'SERVERNAME="Server01"'
    'LICENSINGPORT=16001'
    'INSTALLTOOLBARS="true"'
    'ISDEFAULTDATAINSTALL="true"'
    'INSTALLSTANDARDPARTS="true"'
    '/LOG:C:\Windows\Temp\Install_CAD.log'
)

Interesting. I didn’t know you could do that.