command line switch

ADO DOT NET

Centurion
Joined
Dec 20, 2006
Messages
160
Hi,
I wanna build 2 exe files:
1. Run.exe
2. secret.exe
I want that my user runs Run.exe and then Run.exe executes the secret.exe
I mean I want that if user executes the secret.exe directly, he get an error.
Because these 2 files are independent, I think I have 2 put a command line switch/parameter in secret.exe and pass it via Run.exe to secret.exe.
And secret.exe checks at startup to see if the correct parameter has been passed or not?

My 1st question is that how can I check a switch or command line in my program?


And 2nd question is that how to pass a switch to this:
Visual Basic:
System.Diagnostics.Process.Start("secret.exe /myParameter")
Is that correct?
Thanks:)
 
You can always get the command line passed into your application through
Visual Basic:
Environment.CommandLine

To launch another process and pass in a command line use
Visual Basic:
System.Diagnostics.Process.Start("secret.exe", "/myParameter")
 
Back
Top