I am writing a C # application that should be launched from a USB drive, and runs other programs that are installed in usb. Not necessarily the computer on which he was running. I launch these applications by following these steps:
Process.Start("notmyprogram.exe");
this works fine, but I find that it works only if notmyprogram.exe. installed on your computerโs hard drive. If I want to run a program that is not installed on the computer, but rather on usb, I must call it directly, for example:
Process.Start("D:\\Programs\\notmyprogram\\applicationinstalledonusb.exe");
Where D: is the letter assigned to my OS. However, it is obvious that the drive letter is changed to one computer, usually it will not be D. MY application is located on usb, so my question is: is there a way to find which drive letter my exe is running on, so I could add a directory to the end of the letter drive? Or maybe I'm just wrong, and is there a more efficient way to do this?
source share