WUGNET, the Windows User Group Network
Your Complete Resource Center for "The Best" in Shareware, Computing Tips and Support, Windows Industry News... and much more!
Home Forums Shareware Windows Tips Hot Offers FREE Newsletters Arcade Contact Us About Partners
Search WUGNET: RSS Feeds RSS Feeds Advertise with WUGNET    |    Shareware eBooks
HomeHome FAQFAQ      ProfileProfile    Private MessagesPrivate Messages   Log inLog in

help with reg add in batch file

 
Goto page 1, 2
   Home -> Windows -> Help & Support RSS
Next:  Safely Remove Hardware problem in Windows XP  
Author Message
pete0085

External


Since: Sep 13, 2007
Posts: 18



(Msg. 1) Posted: Fri Jan 25, 2008 9:37 pm
Post subject: help with reg add in batch file
Archived from groups: microsoft>public>windowsxp>help_and_support (more info?)

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?
Back to top
Login to vote
Mark L. Ferguson

External


Since: Dec 17, 2006
Posts: 1747



(Msg. 2) Posted: Sat Jan 26, 2008 7:31 am
Post subject: RE: help with reg add in batch file [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

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
--
Was this helpful? Then click the "Yes" button below. Voting helps the web
interface. http://www.microsoft.com/wn3/locales/help/help_en-us.htm#RateAPost

Mark L. Ferguson


"pete0085" wrote:

> 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?
Back to top
Login to vote
pete0085

External


Since: Sep 13, 2007
Posts: 18



(Msg. 3) Posted: Sat Jan 26, 2008 8:25 am
Post subject: RE: help with reg add in batch file [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

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.

"Mark L. Ferguson" wrote:

> 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
> --
> Was this helpful? Then click the "Yes" button below. Voting helps the web
> interface. http://www.microsoft.com/wn3/locales/help/help_en-us.htm#RateAPost
>
> Mark L. Ferguson
>
>
> "pete0085" wrote:
>
> > 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?
Back to top
Login to vote
Claymore

External


Since: Apr 19, 2007
Posts: 250



(Msg. 4) Posted: Sat Jan 26, 2008 9:04 am
Post subject: Re: help with reg add in batch file [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

On Jan 26, 11:25 am, pete0085 <pete0... DeleteThis @discussions.microsoft.com>
wrote:
> 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..  
>
>
>
> "Mark L. Ferguson" wrote:
> > 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
> > --
> > Was this helpful? Then click the "Yes" button below. Voting helps the web
> > interface.http://www.microsoft.com/wn3/locales/help/help_en-us.htm#RateAPost
>
> > Mark L. Ferguson
>
> > "pete0085" wrote:
>
> > > 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?- Hide quoted text -
>
> - Show quoted text -

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.
Back to top
Login to vote
pete0085

External


Since: Sep 13, 2007
Posts: 18



(Msg. 5) Posted: Sat Jan 26, 2008 10:32 am
Post subject: Re: help with reg add in batch file [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

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.

"Claymore" wrote:

> On Jan 26, 11:25 am, pete0085 <pete0....DeleteThis@discussions.microsoft.com>
> wrote:
> > 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..
> >
> >
> >
> > "Mark L. Ferguson" wrote:
> > > 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
> > > --
> > > Was this helpful? Then click the "Yes" button below. Voting helps the web
> > > interface.http://www.microsoft.com/wn3/locales/help/help_en-us.htm#RateAPost
> >
> > > Mark L. Ferguson
> >
> > > "pete0085" wrote:
> >
> > > > 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?- Hide quoted text -
> >
> > - Show quoted text -
>
> 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.
>
Back to top
Login to vote
Claymore

External


Since: Apr 19, 2007
Posts: 250



(Msg. 6) Posted: Sat Jan 26, 2008 12:46 pm
Post subject: Re: help with reg add in batch file [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

On Jan 26, 1:32 pm, pete0085 <pete0....RemoveThis@discussions.microsoft.com>
wrote:
> 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.
>
>
>
> "Claymore" wrote:
> > On Jan 26, 11:25 am, pete0085 <pete0....RemoveThis@discussions.microsoft.com>
> > wrote:
> > > 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..  
>
> > > "Mark L. Ferguson" wrote:
> > > > 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
> > > > --
> > > > Was this helpful? Then click the "Yes" button below. Voting helps the web
> > > > interface.http://www.microsoft.com/wn3/locales/help/help_en-us.htm#RateAPost
>
> > > > Mark L. Ferguson
>
> > > > "pete0085" wrote:
>
> > > > > 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?- Hide quoted text -
>
> > > - Show quoted text -
>
> > 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.- Hide quoted text -
>
> - Show quoted text -

Hello again,

I'm looking at that reg key you have. Is that just a typo as it should
be USBSTOR, not USBTOR.
Back to top
Login to vote
pete0085

External


Since: Sep 13, 2007
Posts: 18



(Msg. 7) Posted: Sat Jan 26, 2008 2:11 pm
Post subject: Re: help with reg add in batch file [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

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 Smile

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.
> Hello again,
>
> I'm looking at that reg key you have. Is that just a typo as it should
> be USBSTOR, not USBTOR.
>
Back to top
Login to vote
Claymore

External


Since: Apr 19, 2007
Posts: 250



(Msg. 8) Posted: Sat Jan 26, 2008 2:26 pm
Post subject: Re: help with reg add in batch file [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

On Jan 26, 5:11 pm, pete0085 <pete0... DeleteThis @discussions.microsoft.com>
wrote:
> 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 Smile
>
> 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.  
>
>
>
> > Hello again,
>
> > I'm looking at that reg key you have. Is that just a typo as it should
> > be USBSTOR, not USBTOR.- Hide quoted text -
>
> - Show quoted text -

Would it not be easier to just add a shortcut to the batch file to
your Startup folder? (It's what I do myself.)
Back to top
Login to vote
Display posts from previous:   
       Home -> Windows -> Help & Support All times are: Eastern Time (US & Canada) (change)
Goto page 1, 2
Page 1 of 2

 
You can post new topics in this forum
You can reply to topics in this forum
You can edit your posts in this forum
You can delete your posts in this forum
You can vote in polls in this forum
Categories:
  Windows XP
 Windows Vista
 Windows Other
 Office
 Office Other
 Security
  • Home |
  • Shareware |
  • Windows Tips |
  • Hot Offers |
  • FREE Newsletters |
  • Arcade |
  • Forums |
  • eBooks |
  • About WUGNET |
  • Partners |
  • Contact

  • WUGNET Privacy Policy |
  • Link to WUGNET |
  • IT Support