mekilla Posted June 25, 2003 Posted June 25, 2003 Hi, I am wondering if it is possible to start a executable with options in vb.net. Basically I can run a game via start>run, and then add the option +restart 1. So I am running: E:\program files\games\game.exe +restart 1 Everything works fine but I cannot seem to find a way to do it in an application. I have tried to Shell it, use the System.Diagnostics.Process.Start method, and also just create a new Process and start it. Most ways give a file not found exception, some do not. Basically when it works the introduction is skipped. I think the main problem is that I have no idea what this is called, Arguments? EnvironmentVariables? Any ideas or thoughts would be greatly appreciated! Quote
*Experts* Volte Posted June 25, 2003 *Experts* Posted June 25, 2003 System.Diagnostics.Process.Start("E:\Program Files\Games\Game.exe", "+restart 1"):) the Process.Start function has a separate parameter for command line parameters (arguments). Quote
mekilla Posted June 27, 2003 Author Posted June 27, 2003 Thanks for the reply! I actually tried that and it is not working either. In fact just System.Diagnostics.Process.Start("E:\Program Files\Games\Game.exe") does not open it. The computer sounds like it is doing something for a split second but in the end, does nothing. I checked the task manager and it does pop up the game then the game closes which is the same thing that happens when an incorrect arg is sent in. This game seems to dislike this and all shell methods. Is there a way to use the run feature of windows? Quote
mekilla Posted July 1, 2003 Author Posted July 1, 2003 I just figured it out! I only needed to specify a working directory and now everything works fine! Quote
Lamruil Posted July 24, 2003 Posted July 24, 2003 I seem to have a similar problem with my program. How did you specify a working directory? Quote
mekilla Posted August 12, 2003 Author Posted August 12, 2003 Sorry for the late reply! Dim pr As New ProcessStartInfo() pr.WorkingDirectory = "WORKING DIRECTORY" 'Working directory here pr.FileName = "FILE PATH" pr.Arguments = "ARGUMENTS" pr.UseShellExecute = True Process.Start(pr) Quote
Diablicolic Posted August 12, 2003 Posted August 12, 2003 What's the difference between a working directory and the file path? Quote "Reality is fake, Dreams are for real"
*Experts* Volte Posted August 12, 2003 *Experts* Posted August 12, 2003 Working directory is the "default directory" in the program's eyes; if the program attempts to access file using relative path (i.e. "images\img.jpg" instead of "c:\game\moo\images\img.jpg"), that is the directory it will look in. Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.