So I was trying to run an EXE from AutoCAD. During debugging the code would work properly, but once I went to run the code the EXE would attempt to run from the directory path of the current drawing. Frustrating to say the least. In order to run an EXE in it’s location you can utilize the WorkingDirectory Property to set the place where the EXE is going to run from.
Using NewProcess As New Process
NewProcess.StartInfo.WorkingDirectory = System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly.Location())
NewProcess.StartInfo.Arguments = sProgramInfo
NewProcess.StartInfo.FileName = sFileName
The System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly.Location()) gets the path of the current DLL that is running, which happens to be the same location as the EXE program.