Parsing the Command Line on SolidWorks Startup

Document created by Michael Kozikowski Employee on Nov 21, 2019Last modified by Michael Kozikowski Employee on Nov 25, 2019
Version 2Show Document
  • View in full screen mode

Here is a VBA macro that uses Windows APIs to gather the command line commands when starting SolidWorks from that command line. The format for starting SolidWorks from a command line and running a macro on startup is like this:


...\sldworks.exe /m ...\macro.swp


where..\ describes the file path of SolidWorks and the macro itself. The macro name needs to be modified also for your specific situation. This would allow a user to use custom command line switches (flags). Note that /m is required to run a macro on command line startup and any custom switches should come after the full command shown above so it is parsed properly..


Just run the attached macro from a command line and it will produce a msgbox with the full command line command.