|
-
Jan 15th, 2010, 10:06 AM
#1
Thread Starter
Lively Member
[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.
< advertising link removed by moderator >
-
Jan 15th, 2010, 10:18 AM
#2
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
-
Jan 15th, 2010, 10:36 AM
#3
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")
-
Jan 15th, 2010, 11:06 AM
#4
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)
-
Jan 15th, 2010, 11:13 AM
#5
Thread Starter
Lively Member
Re: What's wrong with this 2 lines
Thanks everyone, I got it.
< advertising link removed by moderator >
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|