Saved Bookmarks
| 1. |
Solve : Windows Setup batch file? |
|
Answer» When I set up a new computer, I use both batch files and registry scripts to either add to, subtract from or modify things in Windows and in its registry. Without getting too detailed, I have tried to run a .reg script at the end of a batch file and find that the .reg script never runs, even if I preface it with 'Call'. Actually getting too detailed is exactly what's called for here.Please show us the code so we can all understand what is going on. Quote Is this even possible? Likewise combining a VBScript and a batch file together. Possible? If you don't supply the parent PROCESS (ie: regedit for .reg files or cscript for .vbs files) then the file association is used. A VBScript can run a batch file via the Run method. A batch file can run a VBScript the same as any other NT command. If you mean combining both languages in a single file, YES it can be done by writing one of those god-awful hybrid scripts Thank you. Ok, a typical batch file + registry script would go something like this: Echo off cls del /F /S /W "C:\temp\*.*" Rem Put more lines here to CLEAN out more junk. GrantAdminFullControl.reg It's just that simple. I can run a .exe file, or a .com file, or even another .bat file on that last line and they all run OK, but NOT a .reg file. So I guess I'm asking if anyone knows why it won't run and if there is anything I can do to MAKE it run? If not, it ain't no big deal. I can always do what I've been doing for years, first running all my batch files, then run my registry scripts and then run my VBScripts. Thanks again, The Shadow PS: I came here, to this forum, because I've received some great help here in the past.I can't duplicate your problem. Nothing seems particularly wrong but it may be the .reg association is not set. Did you get any runtime errors? You might try this: Code: [Select]Echo off cls del /F /S /W "C:\temp\*.*" Rem Put more lines here to clean out more junk. cscript //nologo myVBScript.vbs regedit GrantAdminFullControl.reg The call statement is only valid for calling batch files and determines whether the called file returns control to the caller or not. Other executable files should always return control to the caller. With any luck, this may help. Quote from: Sidewinder on March 18, 2012, 12:50:56 PM The call statement is only valid for calling batch files and determines whether the called file returns control to the caller or not. Other executable files should always return control to the caller. You can use the call command for any file that is either executable or has an association. Whew! It's been a long day, after a night of St Patrick's Day FESTIVITIES, but with way more Googling than I really wanted to do, I finally just did a search for "Batch File Commands". When I learned DOS and batch file programming back in the early 80's, there were not so many batch file commands available. I was both surprised and pleased to find the "Start" command. All I had to do is precede the name of my registry script with the command "Start" like this: Rem The following line runs the registry script RegTweaks.reg START RegTweaks.reg There are, of course, a bunch of switches that can be used by that command, but they are not necessary for my purpose. As was mentioned, "Call" is primarily for running one batch file from within another batch file. Thank you all again, for your efforts. The Shadow |
|