How do you Use "C:\Blah.exe" -w in a program?

ryodoan

Well-known member
Joined
Jul 16, 2004
Messages
65
Location
Ohio
Programming Experience
3-5
[RESOLVED] How do you Use "C:\Blah.exe" -w in a program?

Sorry if my title is not that exact, but I noticed on many of the applications I have that you can execute the file with a command string. Such as you can tell some programs "C:\Program Files\Diablo 2\Diablo.exe" -w and it runs in a seperate window instead of full screen.

I am writing a program that randomizes my desktop wallpaper on startup, it starts when the computer starts, changes the background and quits. I want to have a shortcut to it so that if I want to change some settings I can do somethign like "C:\Program Files\Wallpaper Randomizer.exe" -noquit.

Is there a way you can do this in .net?
 
Last edited:
to start another program from you're .net program simply use:
System.Diagnostics.Process.Start("C:\Program Files\Wallpaper Randomizer.exe", "-noquit")

the ', "-noquit"' part is optional as you dont always have to pass arguements

to check to see if an arguement was passed to your program simply loop through the EnvironmentArguements array:
VB.NET:
		Dim strStartupArguments() As String, intCount As Integer
		strStartupArguments = System.Environment.GetCommandLineArgs
		For intCount = 1 To UBound(strStartupArguments)
			Select Case strStartupArguments(intCount).ToLower
				Case "-noquit"
				 'Do your code for the noquit argument
			End Select
		Next intCount
 
Last edited:
shell("C:\Program Files\Wallpaper Randomizer.exe")
use this code to start the any application on the computer from your application
 
Last edited:
Back
Top