I don't need any kind of interface. I just need the program to be an .exe
file that opens a directory (eg. F:).
What kind of template would I use in C#? Would something other than Visual Studio work better? Would a different process entirely work better?
There are a number of ways to display a folder in File Explorer: Click on a folder if it's listed in the Navigation pane. Click on a folder in the Address bar to display its subfolders. Double-click on a folder in the file and folder listing to display any subfolders.
In the File Explorer Options window, click on the "View" tab. Step 3. Check the option "Show hidden files, folders or drives". Also, uncheck "Hide protected operating system files" and "Hide extensions for known file types".
This button can be found in the lower-left corner of the screen, and may just be a Windows logo. Click the Computer or File Explorer button. In Windows 10, this looks like a folder and can be found on the left side of the menu, or in your Windows task bar at the bottom of the screen.
In C#
you can do just that:
Process.Start(@"c:\users\");
This line will throw Win32Exception
when folder doesn't exists. If you'll use Process.Start("explorer.exe", @"C:\folder\");
it will just opened another folder (if the one you specified doesn't exists).
So if you want to open the folder ONLY when it exists, you should do:
try
{
Process.Start(@"c:\users22222\");
}
catch (Win32Exception win32Exception)
{
//The system cannot find the file specified...
Console.WriteLine(win32Exception.Message);
}
Create a batch file , for example open.bat
And write this line
%SystemRoot%\explorer.exe "folder path"
If you really want to do it in C#
class Program
{
static void Main(string[] args)
{
Process.Start("explorer.exe", @"C:\...");
}
}
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