Re: Failed running .bat file from WinXP Explorer

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



Hi Richard,

The main point I wanted to make was that there's a working autoexec.nt
in C:\, while the http://www.computerhope.com/issues/ch000726.htm
thing targeted %HOMEDIR%\system32\autoexec.nt. That seemed strange to
me.

%SystemRoot%\System32 or C:\WINDOWS\System32 is where Autoexec.nt and
Config.nt belong.

I have two copies of Autoexec.nt, one each in...
C:\WINDOWS\system32
and
C:\WINDOWS\repair

I have two copies of Config.nt, one each in...
C:\WINDOWS\system32
and
C:\WINDOWS\repair

The copies in C:\WINDOWS\repair are backup copies created when XP was
installed.

And I have one AUTOEXEC.BAT and one CONFIG.SYS in C:\ and they are both
*totally* empty.

Some evidence on where Config.nt and Autoexec.nt belong.

<quote>
1. Using a text editor, such as Notepad, edit the Config.nt and Autoexec.nt
files (located in systemroot\System32).
<quote>
Microsoft Windows XP - Create custom startup files for an MS-DOS-based
program
http://www.microsoft.com/resources/documentation/windows/xp/all/proddocs/en-us/windows_dos_custom_startup.mspx?mfr=true

<quote>
4. At the command prompt, type the following commands, pressing ENTER after
each command:
expand CD-ROM Drive Letter:\i386\config.nt_ c:\windows\system32\config.nt
expand CD-ROM Drive Letter:\i386\autoexec.nt_
c:\windows\system32\autoexec.nt
APPLIES TO
Microsoft Windows XP Professional
Microsoft Windows XP Home Edition
<quote>
http://support.microsoft.com/kb/324767

<quote>
Check the Config.nt and Autoexec.nt files in the %SystemRoot%\System32
folder

Enter these lines in the Config.nt and Autoexec.nt files in the
%SystemRoot%\System32 folder.
APPLIES TO
Microsoft Windows XP Home Edition
Microsoft Windows XP Professional
<quote>
http://support.microsoft.com/kb/314106

I surmised that the purpose of the PATHEXT variable is:

The environmental variable Pathext shows a list of file extensions that are
considered to be executable and regulates which extensions do not need to be
typed in a Command Prompt or the Run command.

The Path environmental variable and a registry entry, App Paths,
control what paths do not have to be typed.

HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\
CurrentVersion\App Paths\somefile.exe
Value Name: Path
Data Type: REG_EXPAND_SZ
Value Data: Path to executable

If a path is in App Paths, that path does not need to be in the PATH
environment variable. Take msconfig.exe, for example.

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\
CurrentVersion\App Paths\MSCONFIG.EXE
Value Name: (Default)
Data Type: REG_SZ
Value Data: C:\WINDOWS\PCHealth\HelpCtr\Binaries\MSConfig.exe

You can type: msconfig in the Run command or use start msconfig in
a command prompt. You do not need the path or the extension.

Extensions to look for and in what order.

When you run a command that does not contain an extension, Cmd.exe uses the
value of the PATHEXT environment variable to determine which extensions to
look for and in what order. The default value for the PATHEXT variable is:

..COM;.EXE;.BAT;.CMD

(that is, the syntax is the same as the PATH variable, with semicolons
separating the different elements).

When searching for an executable, if there is no match on any extension,
then looks to see if the name matches a directory name. If it does, the
START command launches the Explorer on that path. If done from the command
line, it is the equivalent to doing a CD /D to that path.

When you search for an executable and there is no match on any extension,
start searches directory name. If it does, start opens Explorer.exe on that
path.
from...
Start
http://www.microsoft.com/resources/documentation/windows/xp/all/proddocs/en-us/start.mspx
and start /? in a command prompt.

If you have files named My_Whatever.COM, My_Whatever.EXE My_Whatever.BAT and
My_Whatever.CMD, if you type My_Whatever with no extension My_Whatever.COM
will be found FIRST, then My_Whatever.EXE, then My_Whatever.BAT and then
My_Whatever.CMD.

That's why malware screws people up. Malware will create a file called
cmd.com and place it in the system32 folder. A poor guy types cmd in
the Run command and the command prompt doesn't open for him and he gets a 16
bit MS-DOS Subsystem error instead. If they type cmd.exe in the Run
command the command prompt might open.

--
Hope this helps. Let us know.

Wes
MS-MVP Windows Shell/User

In news:1170782691.948078.130470@xxxxxxxxxxxxxxxxxxxxxxxxxxx,
Richard <RichardDummyMailbox58407@xxxxxxxxxxxxxxxxxxx> hunted and pecked:
Hi Wes,

Thanks for the additional feedback.

Any comments to the right of rem or :: should be ignored.

I know. Those comments were intended to inform you that:
1. The root of my startup partition, designated as C:\, contained an
autoexec.nt file
2. That .NT file is used by WinXP on boot-up, which I'm quite sure
about because I needed (for Visual C++ programming):
2a. "vsvars32.exe" run on startup to define symbols
2b. "F:\PROGRA~1\MICROS~1.NET\Common7\Tools" appended to the path
2c. and those needs were met when I modified that .NT file.

The main point I wanted to make was that there's a working autoexec.nt
in C:\, while the http://www.computerhope.com/issues/ch000726.htm
thing targeted %HOMEDIR%\system32\autoexec.nt. That seemed strange to
me.

I checked PATHEXT, both in a command window:
K:\>echo %pathext%
.COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.RB;.RBW
and HKLM\SYSTEM\CurrentControlSet\Control\Session Manager\Environment
yielded the same result.

You can add F:\PROGRA~1\MICROS~1.NET\Common7\Tools to your Environment
Variables.
Agreed. I like keeping with the path addition with "vsvars32.exe",
which of course I can't put in an environment variable, and its not
worth the trouble to add it to a startup entry in the Registry.

http://support.microsoft.com/kb/310519
"My Computer/Properties" is a nice way to get to the env. variables.
I keep desktop icons for Display, System, Services, Admin. Tools that
I find handy for system management.

My Pathext Experiment 27 August, 2006.
I followed your investigation for a while. Then a Eureka moment
occurred to me. Let me know what you think about it:

I surmised that the purpose of the PATHEXT variable is:
1. Microsoft designed the shell to treat anything without an extension
in a Command Window as a command.
2. But commands really need an extension so that the association with
an executable file can be honored
3. PATHEXT exists to define what possible extensions should be tried
with the putative, given "no-extension command"

That hypothesis led me to think that the run.bat command for
FreeRIDE:
: Original command commented out by me (RLM)
: freeruby-win\bin\ruby.exe -rubygems freeride.rb
: Revised command that I couldn't get working:
ruby -rubygems freeride.rb
is unnecessary.

We can simply type "FreeRIDE" in a Command Window (whose current
working directory is the FreeRide folder) and, voila, the FreeRIDE API
for Ruby programming appears. How does this magic occur? I think the
Windows command.com processor:
1. searches the current directory for a file name freeride.xxx, where
xxx is any of the extensions listed in PATHTXT
2. finds freeride.rb
3. looks up the association with that extension, which is Ruby.exe
(and its folder is on the PATH)
4, invokes Ruby.exe passing along the fully qualified name K:
\_Utilities\FreeRIDE\freeride.rb

"K:\_Utilities\FreeRIDE\freeride.rb" also works in Start | Run,
though it finds it necessary to open a Command window first.

I got the FreeRIDE to come up from Start | Run | FreeRIDE | FreeRIDE.

Unfortunately, FreeRIDE (with no extension) in Start/Run opens the
FreeRIDE Explorer window rather than the API.
And FreeRIDE.rb (with no path) in Start/Run fails, because the shell
only searches a few places for a program.

One last detail: the -rubygems in the original run.bat command is
unnecessary IMHO when FreeRIDE is already installed on the system in
question. "rubygems" is an installation system for Ruby programs and
plugins.

Bottom line: I got around the initial problem I had initially. The
FreeRIDE IDE needs some work.

Again, thank you for sharing your thinking about this problem.

Best wishes,
Richard




On Feb 5, 1:14 am, "Richard"
<RichardDummyMailbox58...@xxxxxxxxxxxxxxxxxxx> wrote:
Wes,

You probably don't want to be bothered with all the details of my
FixAutoConfig.bat script, but for the record I should mention that a
comment in that script is incorrect.

I reported at the end of it that:
Values 2/4/2007 of %homedrive%\autoexec.bat
:: PATH=%PATH%;F:\PROGRA~1\MICROS~1.NET
\Common7\Tools
:: vsvars32.exe

The first line should say:
Values 2/4/2007 of C:\autoexec.nt

I know the C:\autoexec.nt file is processed because I can run Visual
Studio by virtue of the PATH statement and I can use Windows symbols
in C++ without #include statements. The fact that a C:\autoexec.nt is
actually used by Windows, I'm suspicious about whether another
autoexec.nt in %windir%\system32 will really have an effect. Just a
thought ...

Best wishes,
Richard

On Feb 4, 11:10 am, "Wesley Vogel" <123WVogel...@xxxxxxxxxxx> wrote:

Not a valid win32
applicationhttp://www.computerhope.com/issues/ch000726.htm

--
Hope this helps. Let us know.

Wes
MS-MVP Windows Shell/User

Innews:1170555497.528189.71650@xxxxxxxxxxxxxxxxxxxxxxxxxxxx,
Richard <RichardDummyMailbox58...@xxxxxxxxxxxxxxxxxxx> hunted and
pecked:

Hi,

I'm having brain cramps: I double-clicked a filename "Test.bat"
displayed in Windows Explorer under WinXP/SP2, which up-to-date with
Windows Update.

I got a message box claiming "K:\_Utilities\FreeRIDE\Test.bat is not a
valid Win32 application." If I open a command window to invoke
the .bat file, it works fine.

The file and its execution follows. Any ideas?

Thanks in advance,
Richard

====== Test.bat =====
echo Hello, World
== === end ====

====== Command Prompt window ===
K:\_Utilities\FreeRIDE>Test

K:\_Utilities\FreeRIDE>echo Hello, World
Hello, World

K:\_Utilities\FreeRIDE>
========= end ==========

.



Relevant Pages

  • RE: re-setting boot partition
    ... Description of the Windows 2000 Recovery Console ... For a Microsoft Windows XP version of this article, ... MB of hard disk space on your system partition to hold the Cmdcons folder ... Windows NTBoot Console Command Interpreter. ...
    (microsoft.public.win2000.setup_upgrade)
  • Re: Failed running .bat file from WinXP Explorer
    ... both in a command window: ... Microsoft designed the shell to treat anything without an extension ... We can simply type "FreeRIDE" in a Command Window (whose current ...
    (microsoft.public.windowsxp.general)
  • RE: Win2000 Upgrade to SP3 Express Setup error.
    ... Start your computer with the Windows Setup floppy disks, ... MB of hard disk space on your system partition to hold the Cmdcons folder ... Windows NTBoot Console Command Interpreter. ... you cannot copy a file from the local hard disk to a floppy disk. ...
    (microsoft.public.win2000.setup_upgrade)
  • RE: Locating corrupt driver
    ... This article describes the functionality and limitations of the Windows ... Create and format partitions on drives. ... MB of hard disk space on your system partition to hold the Cmdcons folder ... Windows NTBoot Console Command Interpreter. ...
    (microsoft.public.win2000.applications)
  • >>>> NET SEND <<<<
    ... Windows Xp Net Send ... Net Send Command For Mac ... Net Send Syntax Dos ... Dos Net Send Commands ...
    (sci.lang.japan)