[RESOLVED] What's wrong with this 2 lines
I have added bat_fix_w7.reg as a resource file, with binary type, now when i run the code it gives me err
System cannot found the file specified, but when i checked my F: drive the file is there than why 2 line is generating err.
Code:
My.Computer.FileSystem.WriteAllBytes("f:\FixBAT.reg", My.Resources.bat_fix_w7, 0)
Process.Start("regedit /S f:\FixBAT.reg")
Also if possible can someone help, I want to add hex data to regedit.
Re: What's wrong with this 2 lines
line 1 is OK... it's line 2... that's the problem... and it's a common problem... at least one I've seen several times.
Create a process object, set the file name to "regedit" .... then there should be a command line argument property... set that to "/S f:\FixBAT.reg" THEN call the .Start method (no parameters) on your process object variable.
Yeah, I know, how is that any different? I don't know, I just know that when there's command line arguments like that, you have to take a slightly round about path to get it to work.
-tg
Re: What's wrong with this 2 lines
There are various ways to start a new process but the simplest way is much as you've done, except that the file name and the commandline arguments must be specified separately. This is why you should read the documentation: it explains things like this:
vb.net Code:
Process.Start("regedit", "/S f:\FixBAT.reg")
Re: What's wrong with this 2 lines
The long way
Code:
Dim startInfo As New ProcessStartInfo("regedit")
startInfo.WindowStyle = ProcessWindowStyle.Normal
startInfo.Arguments = "/S f:\FixBAT.reg"
Process.Start(startInfo)
Re: What's wrong with this 2 lines
Thanks everyone, I got it.