Click here to Skip to main content
15,906,467 members
Please Sign up or sign in to vote.
2.00/5 (1 vote)
See more:
Hello,
I want to run my program in two ways. Clicking the .exe icon would launch the program and ask the user for a license agreement. The other way would be via a cmd.exe or a python script running the .exe that would not ask for the license agreement. How would I go about doing this? Here is the pseudocode

public partial class MainWindow : Window
    {
         public MainWindow()
         {
              InitializeComponent();
              if(ran via cmd.exe)
               {
                  run program no EULA displayed
               }
               else
               {
                  Check for EULA
               }

              }
Posted
Comments
Sergey Alexandrovich Kryukov 5-Jun-12 0:27am    
Why CMD.EXE?..
--SA

You never need to run CMD.EXE. If you need to run some external program, you can do it with System.Diagnostics.Process.Start. Please see:
http://msdn.microsoft.com/en-us/library/system.diagnostics.process.aspx[^],
http://msdn.microsoft.com/en-us/library/53ezey2s.aspx[^],
http://msdn.microsoft.com/en-us/library/h6ak8zt5.aspx[^].

For the parameters, you need to pass the file name of the program to be executed itself (it can even be a batch file name), the second optional parameter could be the command line. See the documentation referenced above for more advanced options.

—SA
 
Share this answer
 
Comments
Maciej Los 5-Jun-12 14:57pm    
Good answer, my 5!
Sergey Alexandrovich Kryukov 5-Jun-12 15:01pm    
Thank you, Maciej.
--SA
Are you looking for this

Google[^]

Thanks
--RA
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900