Starting a process with a command
Hi!
I want to launch System Restore through my program. I figured out the destination of this feature in Win7 is:
Windows\System32\control.exe sysdm.cpl @0,4
So I wrote this code:
Code:
Dim p As New System.Diagnostics.Process
Private Sub CreateASystemRestorePointToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CreateASystemRestorePointToolStripMenuItem.Click
p.StartInfo.FileName = Environ("windir") & "\System32\control.exe sysdm.cpl @0,4"
p.Start()
End Sub
Problem is that it will not work if I have anything behind .exe
And "sysdm.cpl @0,4" is vital for this to work, otherwise I just launch Control Panel, which is pretty useless for what I want to achieve.
So how do I include commands like those in Visual Basic?
Note: I am fairly new to Visual Basic.
Re: Starting a process with a command
That is obviously not part of the file name, so it can't be included in the String you assign to the FileName property. I wonder if that StartInfo has any other properties that you might assign the rest to. I bet that the MSDN documentation could tell you. You should probably read that.