why does the reg query command hang?

T

Thufir

This command, from the command line, works fine. The batch file
hangs, but I don't know why. A "hello world" batch file worked fine.


Here's the batch file:

Microsoft Windows XP [Version 5.1.2600]
(C) Copyright 1985-2001 Microsoft Corp.

C:\Documents and Settings\thufir>
C:\Documents and Settings\thufir>
C:\Documents and Settings\thufir>cd Desktop

C:\Documents and Settings\thufir\Desktop>
C:\Documents and Settings\thufir\Desktop>
C:\Documents and Settings\thufir\Desktop>type reg.bat
@echo off

rem type reg.bat

reg query "HKLM\SOFTWARE\Microsoft\" /s > registry.txt



C:\Documents and Settings\thufir\Desktop>
C:\Documents and Settings\thufir\Desktop>




thanks,


Thufir
 
P

Pegasus \(MVP\)

Thufir said:
This command, from the command line, works fine. The batch file
hangs, but I don't know why. A "hello world" batch file worked fine.


Here's the batch file:

Microsoft Windows XP [Version 5.1.2600]
(C) Copyright 1985-2001 Microsoft Corp.

C:\Documents and Settings\thufir>
C:\Documents and Settings\thufir>
C:\Documents and Settings\thufir>cd Desktop

C:\Documents and Settings\thufir\Desktop>
C:\Documents and Settings\thufir\Desktop>
C:\Documents and Settings\thufir\Desktop>type reg.bat
@echo off

rem type reg.bat

reg query "HKLM\SOFTWARE\Microsoft\" /s > registry.txt



C:\Documents and Settings\thufir\Desktop>
C:\Documents and Settings\thufir\Desktop>




thanks,


Thufir

Your command does not hang - it keeps running round in
circles. The reason is simple: You gave the batch file the
same name as you gave your executable, namely "reg".
When your batch file runs the line
reg query "HKLM\SOFTWARE\Microsoft\" /s > registry.txt
then it keeps calling itself!

Give your batch file a unique name, e.g. "RegBat.bat". Your
problem will disappear immediately. In future remember that
you must NEVER give a batch file the same name as that
of an executable.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top