If you are writing a command-line program, you would typically take filenames as command line arguments, rather than displaying a File Open dialog. E.g. the user would type:
hidefile c:\files\secret.txt c:\pics\mypicture.jpg
and your program would extract those filenames rather than prompting for them. To do this, use Environment.GetCommandLineArgs
or the string[] args
argument to the Main method.
However, if you do want to display a File Open dialog from a command line app, you can do so: you just need to add a reference to the System.Windows.Forms assembly.