I am writing a c# app that needs to be able to be ran from a usb, and it launches other programs that are installed to the usb. Not necessarily the computer it's being ran on. I am launching these applications by doing:
Process.Start("notmyprogram.exe");
this works great however I am finding that this only works if notmyprogram.exe.
is installed to the computers hard drive. If I want to run a program not installed on the computer, but rather to the usb, I have to call it directly, like so:
Process.Start("D:\\Programs\\notmyprogram\\applicationinstalledonusb.exe");
Where D:
is the letter assigned by my OS. However, obviously the drive letter changes per computer, it wont always be D. MY application is located on the usb so my question is: is there any way to find what drive letter my exe is ran from so I could then append the directory to the end of the drive letter? Or maybe I'm simply going about it the wrong way and there's a more efficient way to accomplish this?