Re: Failed running .bat file from WinXP Explorer



Hi Richard,

but for the record I should mention that a
comment in that script is incorrect.

:-)

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

If you use >> anything to the right will be echoed in the command prompt.

I.e. >> Values 2/4/2007 of C:\autoexec.bat

If you use :: Values 2/4/2007 of C:\autoexec.bat
or rem Values 2/4/2007 of C:\autoexec.bat
it will be ignored as a comment.

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 or Run window.

What does PATHEXT show?

Open a command prompt, type: set hit Enter and scroll to PATHEXT.

At a minimum, PATHEXT should look something like this...
PATHEXT=.COM;.EXE;.BAT;.CMD

Mine has...
PATHEXT=.COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH

See My Pathext Experiment below. Way below. ;-)

You can add F:\PROGRA~1\MICROS~1.NET\Common7\Tools to your Environment
Variables.

System environment variables are in the following Registry key:
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\
Control\Session Manager\Environment
Fro Example... Value Name: Path & Value Name: PATHEXT

If you add to the PATH variable, by doing the following...

To view or change environment variables:
1. Right-click My Computer, and then click Properties.
2. Click the Advanced tab.
3. Click Environment variables.
4. Click one the following options, for either a user or a system variable:
* Click New to add a new variable name and value.
* Click an existing variable, and then click Edit to change its name or
value.
* Click an existing variable, and then click Delete to remove it.
from...
HOW TO Manage Environment Variables in Windows XP
http://support.microsoft.com/kb/310519

You can have F:\PROGRA~1\MICROS~1.NET\Common7\Tools show up any time when
you type path or set in a command prompt without having to set the path in
autoexec.bat. It will always be in the PATH.

If you set the path in the autoexec.bat, path probably gets added in this
registry key.
HKEY_CURRENT_USER\Volatile Environment
This registry key applies to current logon session and is not saved between
logoffs and
restarts.
---------------

My Pathext Experiment 27 August, 2006.

I just created a tracert.com in my System32 folder.

I opened a command prompt, typed: tracert /? and hit Enter.

This error message popped up...

---------------------------
C:\WINDOWS\system32\tracert.com
---------------------------
C:\WINDOWS\system32\tracert.com is not a valid Win32 application.

---------------------------
OK
---------------------------

I clicked OK and
Access is denied.
appeared in the command prompt.
-----

I still have the tracert.com that I created.

I removed everything from, my PATHEXT environment variable.

Opened a command prompt, typed: tracert and hit Enter.

I got the C:\WINDOWS\system32\tracert.com is not a valid Win32 application
error.

I clicked OK.

I got the Access is denied.

I typed: tracert.com and hit Enter.

I got the C:\WINDOWS\system32\tracert.com is not a valid Win32 application
error.

I clicked OK.

I got the Access is denied.

I typed: tracert.exe and hit Enter.

That command worked.

I deleted tracert.com.

I typed: tracert and hit Enter.

And it worked.

That confused me, so I typed: set and hit Enter.

PATHEXT still showed
=.COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH

So I opened the Registry Editor and navigated to
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\
Session Manager\Environment

PATHEXT was empty.

I restored tracert.com to System32.

I rebooted.

I opened a command prompt, typed set and hit Enter.

PATHEXT showed
=.COM;.EXE;.BAT;.CMD;.VBS;.JS;.WS

I did a search for .COM;.EXE;.BAT;.CMD;.VBS;.JS;.WS in the registry.

Found nothing.

I did a search for .COM;.EXE;.BAT in the registry.

Found nothing.

Hmmm.

I put
..COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH
back into PATHEXT environment variable.

PATHEXT is now OK in both
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session
Manager\Environment
and
HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Control\Session Manager\Environment

I deleted tracert.com from System32.

--
Hope this helps. Let us know.

Wes
MS-MVP Windows Shell/User

In news:1170654703.066165.272640@xxxxxxxxxxxxxxxxxxxxxxxxxxxx,
Richard <RichardDummyMailbox58407@xxxxxxxxxxxxxxxxxxx> hunted and pecked:
Hi Wes,

Thanks for responding and inviting me to report back. I checked out
the entry you recommended and applied it, to no avail. Weird, eh?

As I told Ayush in an earlier post, I might just add that until about
a week ago, my WinXP/SP2 has been very stable and virus free. I use
AVG Free Edition, PC Mag's Startup Cop and PrevX. However, I updated
to IE7 last week and the browser is broken in one respect: it won't
open my ISP's home page (it goes into an infinite loop.) Other sites
seem to be OK.

I provide all the gory details of my failure below. These details are
very readable in my Log, as they were written with the formatting
power provided by MS Word. With less formatting control in the
newsgroup, I hope it's not inscrutable.

If you have any other idea about this crazy symptom, I'd be glad to
hear about it. Incidentally, I put together a WSH script workaround
which I'll offer to the FreeRIDE group and use myself. It works well
except it generates a spurious MessageBox when FreeTRIDE is
terminated. In case you're interested, I've included the script at
the very end of this post.

Best wishes,
Richard

· http://www.computerhope.com/issues/ch000726.htm
o REFERENCE NUMBER: CH000726
o Not a valid Win32 application
o Created FixAutoConfig.bat
:: Open a Command Window:
:: Click Start | Run
:: Enter the command cmd.exe
:: Run this file (or copy/paste the follow commands
into the Command Window)
::
:: Switch to the drive housing Windows
%homedrive%
:: Change Directory to the Repair Directory
cd %windir%\Repair
:: Copy startup files for WinXP DOS subsystem
copy autoexec.nt %windir%\system32
copy config.nt %windir%\system32
::
@echo Reboot your system
@pause
:: Values 2/4/2007 of %homedrive%\autoexec.bat
:: PATH=%PATH%;F:\PROGRA~1\MICROS~1.NET
\Common7\Tools
:: vsvars32.exe
o Ran FixAutoConfig.bat in a Command Window:
Copied Autoexec.NT/Config.NT from Repair to System32
C:\>K:\_Utilities\RepairToolsForWindows
\RepairAutoexecConfig\FixAutoConfig.bat
C:\>F:
F:\>cd F:\WINXPPRO\Repair
F:\WINXPPRO\repair>copy autoexec.nt F:\WINXPPRO
\system32
1 file(s) copied.
F:\WINXPPRO\repair>copy config.nt F:\WINXPPRO
\system32
1 file(s) copied.
Reboot your system
Press any key to continue . . .
o Rebooted
o Tested in a Command Window with K:\_Utilities\FreeRIDE>
run.bat
FreeRIDE window opened
o Double-clicked run.bat
Got K:\_Utilities\FreeRIDE\run.bat is not a valid
Win32 application.


=========== RunFreeRIDE.js ===========
// Requires Windows Script Host ... free from Microsoft at:
// http://www.microsoft.com/downloads/details.aspx?
displaylang=en&FamilyID=C717D943-7E4B-4622-86EB-95A22B832CAA

var pgm = "rubyw.exe -rubygems freeride.rb";

var WshShell = new ActiveXObject("WScript.Shell");
var oExec = WshShell.Exec(pgm);
while (oExec.Status == 0)
{
WScript.Sleep(100);
}
WScript.Echo("freeRIDE Exit Status = " + oExec.Status);




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: Microsoft XP CRT Small-Block Heap
    ... affects applications started from the command prompt ... > Anything that I set from a console window reads back with an empty "set" ... > command returns the last setting from the environment variables window. ...
    (microsoft.public.vc.language)
  • Re: Great SWT Program
    ... mostly solve the blind-typing problem that I definitely recall emacs ... Except of course that you need to know some arcane command language ... Hitting tab should insert a tab ... one-line "window" in which the rest of what I type appears, ...
    (comp.lang.java.programmer)
  • Re: Printer Control and Print/Preview Problems
    ... to be appended to the report print stream. ... or "Print" with the DoCmd.OpenReport command, ... still open preview window. ... > following that with an OpenReport using acNormal. ...
    (microsoft.public.access.reports)
  • Re: playtime for spare PCs -Jeff Gaines.
    ... The Black Window is the "Command Prompt Window" & that wouldn't have ... The Window Opens up & Flashes up ... I would expect there to be 2 User Accounts (on a WinXP ...
    (uk.people.silversurfers)
  • Re: A more structured approach
    ... I still find Gas fairly cryptic, but I haven't spent much time with it. ... If we started with no command line parameters, this would point at an environment variable, If we started with one or more command line parameters, this might point to one of them, or to the zero that separates command line args from environment variables. ... I suspect what you tried that *didn't* work was a memory to memory compare "cmpb, ...
    (alt.lang.asm)