How do I get the current directory from which my EXE is running? I have tried the following two codes but they don't work.
Path.GetDirectoryName(Assembly.GetExecutingAssembly().GetName().CodeBase);
Using above I get error "The name "Assembly" does not exist..."
Directory.GetCurrentDirectory()
also doesn't work.
EDIT
Ok I found another code that works but it is giving me directory "\Windows" but my program is running from an SD Card. I copied the program to "Program Files" folder on device but it again gave me directory "\Windows".
How do I get the current directory or more specifically how do I get SD Card/Flash Memory path?
Problem solved by using:
System.Reflection.Assembly.GetExecutingAssembly().GetName().CodeBase;
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With