Batch file just goes to cmd.exe screen?

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have a XP at office and have the problem ...

When I create a batch file
(e.g. c:\hello.bat
echo hello)

and double click it in the windows explorer,
the cmd.exe windows will open but the script will not run at all.
if in the prompt, I type hello , the echo text can be shown .

Do you guys know why the scipt will not be run at all but just open the
cmd.exe windows only?
 
Try these two lines.

echo hello
pause

--
Hope this helps. Let us know.

Wes
MS-MVP Windows Shell/User

In
 
Wesley,

I don't mean I want to stay in the cmd.exe windows.

hello.bat -

echo hello

The scenairo is that when I double click the hello.bat in windows explorer,
the cmd.exe windows just opens and do not run the 'echo hello' command at all.


What you suggested is another thing, to stay to cmd.exe windows after the
hello is echo to the standard output.


--

- Impossible is nothing


Wesley Vogel said:
Try these two lines.

echo hello
pause

--
Hope this helps. Let us know.

Wes
MS-MVP Windows Shell/User

In
 
Matt,

Click Start, Run and type:

reg export hkcr\batfile c:\batfile.txt

Then open C:\batfile.txt using Notepad. Copy the entire contents, and paste
them in your reply.

--
Regards,

Ramesh Srinivasan, Microsoft MVP [Windows XP Shell/User]
Windows® XP Troubleshooting http://www.winhelponline.com


Wesley,

I don't mean I want to stay in the cmd.exe windows.

hello.bat -

echo hello

The scenairo is that when I double click the hello.bat in windows explorer,
the cmd.exe windows just opens and do not run the 'echo hello' command at
all.


What you suggested is another thing, to stay to cmd.exe windows after the
hello is echo to the standard output.
 
Matt,

I did misunderstand.

Your .bat file associations are probably screwed up as Ramesh pointed out.

If your .bat file associations are screwed up.

Windows® XP File Association Fixes
Copyright 2003 - Doug Knox
http://www.dougknox.com/xp/file_assoc.htm

Read the instructions. Then get...

Batch File Association Fix (Restore the default associations for BAT files)

--
Hope this helps. Let us know.

Wes
MS-MVP Windows Shell/User

In
 
Matt said:
Wesley,

I don't mean I want to stay in the cmd.exe windows.

hello.bat -

echo hello

The scenairo is that when I double click the hello.bat in windows explorer,
the cmd.exe windows just opens and do not run the 'echo hello' command at all.


What you suggested is another thing, to stay to cmd.exe windows after the
hello is echo to the standard output.

You're indicating that it's not an association problem either. Since it
opens the command prompt.


try opening the command prompt manually (cmd.exe) and then run (don't
click) hello.bat
and see if it works.
what if you type into the batch file

sdf
sdf
sdfsd
fd
f

and then run the batch file
does it still open the command prompt window but do nothing?

if I create a bat file "a.bat " and type junk in it , and put it in
c:\

then start..run.. cmd /k c:\a.bat

It works for me
Looks like you haven't done much diagnosis yourself on what works and
what doesn't work
 
Back
Top