Open file in SOLIDWORKS using commandline (Command Prompt or Cmd)?

Does anyone know how to use the command line to open a file in SOLIDWORKS?

I’ve used a batch file to do it with this line of code:

START /d “C:\Program Files\SOLIDWORKS 2020\SOLIDWORKS (2)” SLDWORKS.exe

I think this will work in command prompt as well if you change the path to match your installation

Edit: I just realized you said file. Perhaps changing sldworks.exe to filename.extension and the path to the file’s directory will work for that. I can’t test it until tomorrow though.

Edit2: I just tested this and it works with files as well.
START /d "your path to directory here" filename.extension

Do you mean Start “Path to sldworks.exe” “path sld document” ?

If you had a part saved in your “My Documents” folder that you wanted to open, this would be the command to run.

image

This is the equivalent of double clicking on the icon in your folder window if you were to browse to the location on your PC

1 Like

I thought you needed to include the path to the sldworks.exe. That prolly won’t work if you had two versions. You will get a window asking you to choose which version of sw to use.

You’re right, I stumbled upon this method when looking for alternatives this morning.

I checked with both my 2018 and 2021 installations and the correct version opens each time when the path to the exe is changed. The first set of empty quotes are necessary for this to work.

start "" "path to solidworks exe" "path to file being opened"