PC Review


Reply
Thread Tools Rate Thread

Can't execute batch file without extension

 
 
zhongsheng
Guest
Posts: n/a
 
      20th Feb 2008
Hi,

I have this batch command problem and don't know how to resolve it.

For example, I have a batch file called mytest.bat.

It works if I double click it in Windows Explorer
It works if I type mytest.bat in DOS Window
It does not work if I just type mytest.

I can't find any reference to this problem. I hope somebody can point me out
on this. This prevents me from doing lots of stuff.

Thanks,

zhongsheng
 
Reply With Quote
 
 
 
 
Pegasus \(MVP\)
Guest
Posts: n/a
 
      20th Feb 2008

"zhongsheng" <(E-Mail Removed)> wrote in message
news:22BF74EC-B90D-47C4-9B91-(E-Mail Removed)...
> Hi,
>
> I have this batch command problem and don't know how to resolve it.
>
> For example, I have a batch file called mytest.bat.
>
> It works if I double click it in Windows Explorer
> It works if I type mytest.bat in DOS Window
> It does not work if I just type mytest.
>
> I can't find any reference to this problem. I hope somebody can point me
> out
> on this. This prevents me from doing lots of stuff.
>
> Thanks,
>
> zhongsheng


What do you see when you do this:
1. Create the file c:\MyTest.bat
2. Put this line inside:
echo Hello world.
3. Open a Command Prompt (Click Start / Run / cmd {OK}
4. Type this command:
c:\MyTest {Enter}


 
Reply With Quote
 
zhongsheng
Guest
Posts: n/a
 
      20th Feb 2008
Thanks for the reply,

It says:

C:\>mytest
'mytest' is not recognized as an internal or external command,
operable program or batch file.


zhongsheng

"Pegasus (MVP)" wrote:

>
> "zhongsheng" <(E-Mail Removed)> wrote in message
> news:22BF74EC-B90D-47C4-9B91-(E-Mail Removed)...
> > Hi,
> >
> > I have this batch command problem and don't know how to resolve it.
> >
> > For example, I have a batch file called mytest.bat.
> >
> > It works if I double click it in Windows Explorer
> > It works if I type mytest.bat in DOS Window
> > It does not work if I just type mytest.
> >
> > I can't find any reference to this problem. I hope somebody can point me
> > out
> > on this. This prevents me from doing lots of stuff.
> >
> > Thanks,
> >
> > zhongsheng

>
> What do you see when you do this:
> 1. Create the file c:\MyTest.bat
> 2. Put this line inside:
> echo Hello world.
> 3. Open a Command Prompt (Click Start / Run / cmd {OK}
> 4. Type this command:
> c:\MyTest {Enter}
>
>
>

 
Reply With Quote
 
Pegasus \(MVP\)
Guest
Posts: n/a
 
      20th Feb 2008
OK. Now what to you see when you open a Command Prompt
and type these commands:
set pathext{Enter}
assoc .bat{Enter}


"zhongsheng" <(E-Mail Removed)> wrote in message
news:E1B62D12-C4EF-47F9-92ED-(E-Mail Removed)...
> Thanks for the reply,
>
> It says:
>
> C:\>mytest
> 'mytest' is not recognized as an internal or external command,
> operable program or batch file.
>
>
> zhongsheng
>
> "Pegasus (MVP)" wrote:
>
>>
>> "zhongsheng" <(E-Mail Removed)> wrote in message
>> news:22BF74EC-B90D-47C4-9B91-(E-Mail Removed)...
>> > Hi,
>> >
>> > I have this batch command problem and don't know how to resolve it.
>> >
>> > For example, I have a batch file called mytest.bat.
>> >
>> > It works if I double click it in Windows Explorer
>> > It works if I type mytest.bat in DOS Window
>> > It does not work if I just type mytest.
>> >
>> > I can't find any reference to this problem. I hope somebody can point
>> > me
>> > out
>> > on this. This prevents me from doing lots of stuff.
>> >
>> > Thanks,
>> >
>> > zhongsheng

>>
>> What do you see when you do this:
>> 1. Create the file c:\MyTest.bat
>> 2. Put this line inside:
>> echo Hello world.
>> 3. Open a Command Prompt (Click Start / Run / cmd {OK}
>> 4. Type this command:
>> c:\MyTest {Enter}
>>
>>
>>



 
Reply With Quote
 
zhongsheng
Guest
Posts: n/a
 
      20th Feb 2008
Here it is:

C:\>set pathext
PATHEXT=.com;.exe;.cmd;.vbs;.js;.jse;.wsf;.wsh;.pl;.pls

C:\>assoc .bat
..bat=batfile

Thanks,

zhongsheng

"Pegasus (MVP)" wrote:

> OK. Now what to you see when you open a Command Prompt
> and type these commands:
> set pathext{Enter}
> assoc .bat{Enter}
>
>
> "zhongsheng" <(E-Mail Removed)> wrote in message
> news:E1B62D12-C4EF-47F9-92ED-(E-Mail Removed)...
> > Thanks for the reply,
> >
> > It says:
> >
> > C:\>mytest
> > 'mytest' is not recognized as an internal or external command,
> > operable program or batch file.
> >
> >
> > zhongsheng
> >
> > "Pegasus (MVP)" wrote:
> >
> >>
> >> "zhongsheng" <(E-Mail Removed)> wrote in message
> >> news:22BF74EC-B90D-47C4-9B91-(E-Mail Removed)...
> >> > Hi,
> >> >
> >> > I have this batch command problem and don't know how to resolve it.
> >> >
> >> > For example, I have a batch file called mytest.bat.
> >> >
> >> > It works if I double click it in Windows Explorer
> >> > It works if I type mytest.bat in DOS Window
> >> > It does not work if I just type mytest.
> >> >
> >> > I can't find any reference to this problem. I hope somebody can point
> >> > me
> >> > out
> >> > on this. This prevents me from doing lots of stuff.
> >> >
> >> > Thanks,
> >> >
> >> > zhongsheng
> >>
> >> What do you see when you do this:
> >> 1. Create the file c:\MyTest.bat
> >> 2. Put this line inside:
> >> echo Hello world.
> >> 3. Open a Command Prompt (Click Start / Run / cmd {OK}
> >> 4. Type this command:
> >> c:\MyTest {Enter}
> >>
> >>
> >>

>
>
>

 
Reply With Quote
 
Pegasus \(MVP\)
Guest
Posts: n/a
 
      20th Feb 2008
Your %pathext% lacks the .bat component. You need to restore it here,
then reboot the machine:
HKLM\SYSTEM\CurrentControlSet\Control\Session Manager\Environment

You can test this immediately by renaming your batch file to
MyTest.cmd. Does this work?


"zhongsheng" <(E-Mail Removed)> wrote in message
news:F8845F5B-8ADC-4C9E-AB0D-(E-Mail Removed)...
> Here it is:
>
> C:\>set pathext
> PATHEXT=.com;.exe;.cmd;.vbs;.js;.jse;.wsf;.wsh;.pl;.pls
>
> C:\>assoc .bat
> .bat=batfile
>
> Thanks,
>
> zhongsheng
>
> "Pegasus (MVP)" wrote:
>
>> OK. Now what to you see when you open a Command Prompt
>> and type these commands:
>> set pathext{Enter}
>> assoc .bat{Enter}
>>
>>
>> "zhongsheng" <(E-Mail Removed)> wrote in message
>> news:E1B62D12-C4EF-47F9-92ED-(E-Mail Removed)...
>> > Thanks for the reply,
>> >
>> > It says:
>> >
>> > C:\>mytest
>> > 'mytest' is not recognized as an internal or external command,
>> > operable program or batch file.
>> >
>> >
>> > zhongsheng
>> >
>> > "Pegasus (MVP)" wrote:
>> >
>> >>
>> >> "zhongsheng" <(E-Mail Removed)> wrote in message
>> >> news:22BF74EC-B90D-47C4-9B91-(E-Mail Removed)...
>> >> > Hi,
>> >> >
>> >> > I have this batch command problem and don't know how to resolve it.
>> >> >
>> >> > For example, I have a batch file called mytest.bat.
>> >> >
>> >> > It works if I double click it in Windows Explorer
>> >> > It works if I type mytest.bat in DOS Window
>> >> > It does not work if I just type mytest.
>> >> >
>> >> > I can't find any reference to this problem. I hope somebody can
>> >> > point
>> >> > me
>> >> > out
>> >> > on this. This prevents me from doing lots of stuff.
>> >> >
>> >> > Thanks,
>> >> >
>> >> > zhongsheng
>> >>
>> >> What do you see when you do this:
>> >> 1. Create the file c:\MyTest.bat
>> >> 2. Put this line inside:
>> >> echo Hello world.
>> >> 3. Open a Command Prompt (Click Start / Run / cmd {OK}
>> >> 4. Type this command:
>> >> c:\MyTest {Enter}
>> >>
>> >>
>> >>

>>
>>
>>



 
Reply With Quote
 
zhongsheng
Guest
Posts: n/a
 
      20th Feb 2008
Thank you very much.

I changed that from environment variable table. It works now. I am wondering
how has that happened. I don't believe I have ever touched pathext before
from neither environment variable nor regedit.

zhongsheng

"Pegasus (MVP)" wrote:

> Your %pathext% lacks the .bat component. You need to restore it here,
> then reboot the machine:
> HKLM\SYSTEM\CurrentControlSet\Control\Session Manager\Environment
>
> You can test this immediately by renaming your batch file to
> MyTest.cmd. Does this work?
>
>
> "zhongsheng" <(E-Mail Removed)> wrote in message
> news:F8845F5B-8ADC-4C9E-AB0D-(E-Mail Removed)...
> > Here it is:
> >
> > C:\>set pathext
> > PATHEXT=.com;.exe;.cmd;.vbs;.js;.jse;.wsf;.wsh;.pl;.pls
> >
> > C:\>assoc .bat
> > .bat=batfile
> >
> > Thanks,
> >
> > zhongsheng
> >
> > "Pegasus (MVP)" wrote:
> >
> >> OK. Now what to you see when you open a Command Prompt
> >> and type these commands:
> >> set pathext{Enter}
> >> assoc .bat{Enter}
> >>
> >>
> >> "zhongsheng" <(E-Mail Removed)> wrote in message
> >> news:E1B62D12-C4EF-47F9-92ED-(E-Mail Removed)...
> >> > Thanks for the reply,
> >> >
> >> > It says:
> >> >
> >> > C:\>mytest
> >> > 'mytest' is not recognized as an internal or external command,
> >> > operable program or batch file.
> >> >
> >> >
> >> > zhongsheng
> >> >
> >> > "Pegasus (MVP)" wrote:
> >> >
> >> >>
> >> >> "zhongsheng" <(E-Mail Removed)> wrote in message
> >> >> news:22BF74EC-B90D-47C4-9B91-(E-Mail Removed)...
> >> >> > Hi,
> >> >> >
> >> >> > I have this batch command problem and don't know how to resolve it.
> >> >> >
> >> >> > For example, I have a batch file called mytest.bat.
> >> >> >
> >> >> > It works if I double click it in Windows Explorer
> >> >> > It works if I type mytest.bat in DOS Window
> >> >> > It does not work if I just type mytest.
> >> >> >
> >> >> > I can't find any reference to this problem. I hope somebody can
> >> >> > point
> >> >> > me
> >> >> > out
> >> >> > on this. This prevents me from doing lots of stuff.
> >> >> >
> >> >> > Thanks,
> >> >> >
> >> >> > zhongsheng
> >> >>
> >> >> What do you see when you do this:
> >> >> 1. Create the file c:\MyTest.bat
> >> >> 2. Put this line inside:
> >> >> echo Hello world.
> >> >> 3. Open a Command Prompt (Click Start / Run / cmd {OK}
> >> >> 4. Type this command:
> >> >> c:\MyTest {Enter}
> >> >>
> >> >>
> >> >>
> >>
> >>
> >>

>
>
>

 
Reply With Quote
 
Pegasus \(MVP\)
Guest
Posts: n/a
 
      20th Feb 2008
Congratulations!
By thinking of the time when it happened, you can probably
work out "who dunnit", e.g.
- Some software installation
- Malware
- Virus infection
- Someone else playing with your machine
- You playing with your machine


"zhongsheng" <(E-Mail Removed)> wrote in message
news:2B6992C8-CDAF-4B4C-9387-(E-Mail Removed)...
> Thank you very much.
>
> I changed that from environment variable table. It works now. I am
> wondering
> how has that happened. I don't believe I have ever touched pathext before
> from neither environment variable nor regedit.
>
> zhongsheng
>
> "Pegasus (MVP)" wrote:
>
>> Your %pathext% lacks the .bat component. You need to restore it here,
>> then reboot the machine:
>> HKLM\SYSTEM\CurrentControlSet\Control\Session Manager\Environment
>>
>> You can test this immediately by renaming your batch file to
>> MyTest.cmd. Does this work?
>>
>>
>> "zhongsheng" <(E-Mail Removed)> wrote in message
>> news:F8845F5B-8ADC-4C9E-AB0D-(E-Mail Removed)...
>> > Here it is:
>> >
>> > C:\>set pathext
>> > PATHEXT=.com;.exe;.cmd;.vbs;.js;.jse;.wsf;.wsh;.pl;.pls
>> >
>> > C:\>assoc .bat
>> > .bat=batfile
>> >
>> > Thanks,
>> >
>> > zhongsheng
>> >
>> > "Pegasus (MVP)" wrote:
>> >
>> >> OK. Now what to you see when you open a Command Prompt
>> >> and type these commands:
>> >> set pathext{Enter}
>> >> assoc .bat{Enter}
>> >>
>> >>
>> >> "zhongsheng" <(E-Mail Removed)> wrote in message
>> >> news:E1B62D12-C4EF-47F9-92ED-(E-Mail Removed)...
>> >> > Thanks for the reply,
>> >> >
>> >> > It says:
>> >> >
>> >> > C:\>mytest
>> >> > 'mytest' is not recognized as an internal or external command,
>> >> > operable program or batch file.
>> >> >
>> >> >
>> >> > zhongsheng
>> >> >
>> >> > "Pegasus (MVP)" wrote:
>> >> >
>> >> >>
>> >> >> "zhongsheng" <(E-Mail Removed)> wrote in
>> >> >> message
>> >> >> news:22BF74EC-B90D-47C4-9B91-(E-Mail Removed)...
>> >> >> > Hi,
>> >> >> >
>> >> >> > I have this batch command problem and don't know how to resolve
>> >> >> > it.
>> >> >> >
>> >> >> > For example, I have a batch file called mytest.bat.
>> >> >> >
>> >> >> > It works if I double click it in Windows Explorer
>> >> >> > It works if I type mytest.bat in DOS Window
>> >> >> > It does not work if I just type mytest.
>> >> >> >
>> >> >> > I can't find any reference to this problem. I hope somebody can
>> >> >> > point
>> >> >> > me
>> >> >> > out
>> >> >> > on this. This prevents me from doing lots of stuff.
>> >> >> >
>> >> >> > Thanks,
>> >> >> >
>> >> >> > zhongsheng
>> >> >>
>> >> >> What do you see when you do this:
>> >> >> 1. Create the file c:\MyTest.bat
>> >> >> 2. Put this line inside:
>> >> >> echo Hello world.
>> >> >> 3. Open a Command Prompt (Click Start / Run / cmd {OK}
>> >> >> 4. Type this command:
>> >> >> c:\MyTest {Enter}
>> >> >>
>> >> >>
>> >> >>
>> >>
>> >>
>> >>

>>
>>
>>



 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
execute batch file does not execute all command lines John Grandy Microsoft C# .NET 3 17th Dec 2009 01:01 AM
file wilth msp extension does not execute Heribert Riesbeck Windows XP Help 1 28th Sep 2005 10:16 PM
execute batch file =?Utf-8?B?Q2hyaXM=?= Microsoft ASP .NET 3 13th Jul 2005 08:45 PM
running a batch file without the .bat extension? McBob Windows XP General 2 1st Jun 2004 09:32 PM
RE: how do I execute batch file from asp.net =?Utf-8?B?QjBuag==?= Microsoft ASP .NET 0 4th May 2004 11:11 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 07:26 AM.