Login | |
|
 |
RE: call a .reg file from VBS, how? - 9/20/2005 11:31:31 PM
|
|
 |
|
| |
Country73
Posts: 712
Score: 8
Joined: 8/25/2004
From: USA
Status: offline
|
You could also just change WshShell.run "regedit /S c:\vptray.reg",1,True to WshShell.run "regedit /S c:\vptray.reg",0,True
|
|
| |
|
|
|
 |
RE: call a .reg file from VBS, how? - 9/21/2005 4:22:41 AM
|
|
 |
|
| |
Country73
Posts: 712
Score: 8
Joined: 8/25/2004
From: USA
Status: offline
|
Using WshShell.run, the setup is: object.Run strCommand, intWindowStyle, bWaitOnReturn "0" Hides the window "1" Activates and displays a window This line of code will hide the CMD window (0) and wait for it to complete before going on to the next step: WshShell.Run "regedit /S c:\vptray.reg",0,True This will show the CMD window (1) and wait for it to complete before going on the the next step: WshShell.Run "regedit /S c:\vptray.reg",1,True You can omit: Do While oExec.Status = 0 WScript.Sleep 100 Loop Because the TRUE at the end of our line takes care of it.(bWaitOnReturn) The only thing you will need to put in to run your reg file (without showing the cmd window) is: Set wShell = CreateObject("WScript.Shell") wShell.Run "regedit /S c:\vptray.reg",0,True Then continue on with your code. Actually, you can click on the link in my sig "Script56.chm" and you can download the Help File which makes it a lot easier to locate that sort of stuff. (Same as what you would find from the link that Sethsdad posted but at your finger tips)
< Message edited by Country73 -- 9/21/2005 4:38:02 AM >
|
|
| |
|
|
|
 |
RE: call a .reg file from VBS, how? - 9/21/2005 5:01:14 AM
|
|
 |
|
| |
kracksmith
Posts: 198
Score: 0
Joined: 2/24/2005
From:
Status: offline
|
ok Thanks for everyone's help. We are really making good progress here. Here is my final working sript for this problem: Set network = WScript.CreateObject("WScript.Network") Set fso = WScript.CreateObject("Scripting.FileSystemObject") Set WshShell = Wscript.CreateObject("Wscript.Shell") fso.CopyFile "\\Prod2\N_Drive\Public\vptray.reg", "C:\Documents and Settings\All Users\Desktop\" WScript.Sleep 500 WshShell.run "regedit /S ""C:\Documents and Settings\All Users\Desktop\vptray.reg""",0,True WScript.Sleep 30000 fso.DeleteFile "C:\Documents and Settings\All Users\Desktop\vptray.reg" What's the purpose of the DIM? when i use the DIM it works and when I don't use it, it still works. If i don't use it, i don't need to set DIM to nothing at the end. Also I wasn't able to copy things to the C:\ as most workstation we have here are power user with no rights to write to the C:\. So I changed it to "C:\Documents and Settings\All Users\Desktop\" I also stayed with "WshShell.run "regedit /S ""C:\Documents and Settings\All Users\Desktop\vptray.reg""",0,True" instead of "wShell.Run "regedit /S C:\Documents and Settings\All Users\Desktop\vptray.reg",2021,True" as 2021 didn't quite work out for me. Is it supposed to be commas before and after?
|
|
| |
|
|
|
 |
RE: call a .reg file from VBS, how? - 9/21/2005 5:08:09 AM
|
|
 |
|
| |
Country73
Posts: 712
Score: 8
Joined: 8/25/2004
From: USA
Status: offline
|
The 2021 was fat fingered and I guess I didn't get it corrected quickly enough. The Dim is required whenever you use "Option Explicit" on your scripts. If you don't use Option Explicit, then you don't need to use Dim. If you downloaded the Script56.chm, or you can go out to the site that Sethsdad posted, you can look up Option Explicit for more information. Also, you can probably get rid of the "Wscript.Sleep 30000" unless you're wanting a pause after the reg file has completed.
|
|
| |
|
|
|
|
|