0

How can I restart application without Command Line Arguments?

Say i have my app started with some arguments, but on restart i want to get rid of any arguments.

Application.Restart(); will restart app using the same command line arguments that were used to start app in the first place.

Don't really want to use second app to start the first one.

Felix
  • 830
  • 10
  • 17
  • 1
    why dont you read the arguments in your `main(args)`, create a batch command in the same working directory, and execute a shutdown and a execute on the batch... then when loaded, simply delete the batch if exist ... you should also read: http://stackoverflow.com/questions/95098/why-is-application-restart-not-reliable – balexandre Jul 15 '13 at 23:18
  • @balexandre: That requires him to figure out how to execute a batch file... which is no easier than executing his program without arguments. The batch file is useful for self-overwriting updaters, maybe. But not needed here. – Ben Voigt Jul 15 '13 at 23:30
  • @BenVoigt that's how I do my updates when a new update is available to the user - just wanted to give my 2 cents on what he can accomplish something that works now and might be useful in the future :) – balexandre Jul 15 '13 at 23:32
  • @balexandre: But nothing in this question suggests an updater. – Ben Voigt Jul 15 '13 at 23:33
  • 1
    @BenVoigt true, that's why it's a comment and not an answer ;) – balexandre Jul 15 '13 at 23:36

1 Answers1

2

You can use Process.Start to launch any program with any arguments you like.

Ben Voigt
  • 277,958
  • 43
  • 419
  • 720