Go Back   TechArena Community > Technical Support > Computer Help > Windows XP > Windows XP Support
Become a Member!
Forgot your username/password?
Tags Active Topics RSS Search Mark Forums Read

Sponsored Links



help with reg add in batch file

Windows XP Support


Reply
 
Thread Tools Search this Thread
  #1  
Old 26-01-2008
pete0085
 
Posts: n/a
help with reg add in batch file

I am trying to run a reg add command in a batch file but it does not execute.
The command runs fine in the command prompt.

REG ADD "HKLM\System\CurrentControlSet\Services\USBTOR" /v Start /t
REG_DWORD /d 4 /f

What am I missing here?

Reply With Quote
  #2  
Old 26-01-2008
Mark L. Ferguson
 
Posts: n/a
RE: help with reg add in batch file

The quote mark may be interpreted as an 'escape' character. I would use two
in a row, or perhaps the 'single quote mark' character.

ADD ""HKLM\System\CurrentControlSet\Services\USBTOR"" /v

ADD 'HKLM\System\CurrentControlSet\Services\USBTOR' /v
Reply With Quote
  #3  
Old 26-01-2008
pete0085
 
Posts: n/a
RE: help with reg add in batch file

Still can't get it to work. This is weird, I have run similar commands from
a batch file to edit the reg before. Is there another setting in the
registry that allows or denies you to excute a batch file?

I will take a look at my other batch file to see if there is any difference
in the syntax.

If it runs via command prompt, it should, in theory, run from a batch file.
Reply With Quote
  #4  
Old 26-01-2008
Claymore
 
Posts: n/a
Re: help with reg add in batch file

First, in this paricular forum I'm using it's hard to see if it's all
on one line because of text wrapping, but the command is all on one
line, like this:

reg add "HKLM\System\CurrentControlSet\Services\USBTOR" /v "Start" /t
REG_DWORD /d 4 /f

Note the quotes around the Value.

/v specifies the value to change, /t the type of the value, /d the
data to write, and /f will force the data to be written, even if the
value exists already.
Reply With Quote
  #5  
Old 27-01-2008
pete0085
 
Posts: n/a
The command is one line. I have tried the extra quotes and without. I
looked at a previous batch file and it didn't have any quotes and would run
without a problem.

The previous batch files I used added a new entry. I am not "adding" a new
entry, but modifying it. The data is changing from 3 to 4.

Maybe this helps, but I am lost at the moment. I can export the setting and
run it as a .reg file. I would like to someone use it as a startup script
via group policy and a batch file seemed to be the easiest.
I'm looking at that reg key you have. Is that just a typo as it should
be USBSTOR, not USBTOR.
Reply With Quote
  #6  
Old 27-01-2008
pete0085
 
Posts: n/a
It was a typo on my part.

I am not sure how or why, but it works now. I created a new text document,
retyped everything in lower case and saved it as a .bat.

There are no quotes around the text. This doesn't make any sense, but I
tested in a few times and it works. Only difference is the lower case.
Should I blame the gremlins for this one?

All I care about is it works :)

Thanks for your assistance on this. Now my next problem is figuring out why
it doesn't work as a startup script in group policy, but it works if I double
click the file. I actually have other reg add scripts that didn't work via
group policy, so I'm guessing it's a universal issue.

Would it not be easier to just add a shortcut to the batch file to
your Startup folder? (It's what I do myself.)
Reply With Quote
  #7  
Old 27-01-2008
pete0085
 
Posts: n/a
Re: help with reg add in batch file

I need to be able to easily push it out to all the workstations. I can put
it in the startup folder, but I would need to go around to each pc and that
is time consuming.
Reply With Quote
  #8  
Old 03-11-2009
Member
 
Join Date: Nov 2009
Posts: 1
Re: help with reg add in batch file

I know this is way past original post, and I'm not sure about all lower case but I tend to do that...anyway, quotes are often necessary. For instance, in my example to set a explorer home page..

reg add "hkcu\software\microsoft\internet explorer\main" /v "start page" /d "http://www.google.com" /f
Reply With Quote
Reply

  TechArena Community > Technical Support > Computer Help > Windows XP > Windows XP Support
Tags: , , ,



Thread Tools Search this Thread
Search this Thread:

Advanced Search


Similar Threads for: "help with reg add in batch file"
Thread Thread Starter Forum Replies Last Post
make file name list in excel using batch file shibinpanayi Windows Software 1 04-06-2011 03:44 AM
Windows Batch file to output directory names and size to txt file m2thearkus Software Development 6 16-07-2010 12:04 AM
How can I play a sound file from a Windows batch file? Linoo Operating Systems 4 27-03-2010 07:20 PM
Dos batch file to sort files based on file names. Jon Osborn Windows Server Help 9 17-06-2009 11:06 AM
Batch file to copy a file from the local drive to a computer on lan? dudelearn Tips & Tweaks 3 12-03-2009 12:56 PM


All times are GMT +5.5. The time now is 09:16 AM.