Hello Andrew,
Being a PSS person, I did test this before posting and you are right it is
easy to test.
I actually looked at this about a month or so as well for a different
posting.
But I since it was your posting and I respect your knowledge of Windows, I
felt I needed to validate this one more time before I posted a reply to
this.
I added both a set variable and a path statement to the c:\autoexec.bat
file.
Set DGG-c:\DGG
Path=c:\tools
Rebooted the machine, opened an elevated cmd prompt
and ran "Set"
The path statement was appended to the end of my existing path statement
and the new variable appears listed in the output.
Subt is a command, not a environment variable and it isn't going to work. I
agree with that.
We only grab env variables from the autoexec.bat
The autoexec file is parsed on my Vista machines not sure why it isn't
being parsed on yours Andrew.
Now I didn't do the %path%, however the path statement in the autoexec was
just appended anyway.
Thanks,
Darrell Gorter[MSFT]
This posting is provided "AS IS" with no warranties, and confers no rights
--------------------
|> From: "Andrew McLaren" <
[email protected]>
|> References: <
[email protected]>
<
[email protected]>
<
[email protected]>
|> In-Reply-To: <
[email protected]>
|> Subject: Re: Autoexec.bat not working at restart
|> Date: Fri, 13 Jul 2007 12:53:55 +1000
|> Lines: 53
|> Organization: Not much ...
|> Message-ID: <
[email protected]>
|> X-Priority: 3
|> X-MSMail-Priority: Normal
|> X-Newsreader: Microsoft Windows Mail 6.0.6000.16480
|> X-MimeOLE: Produced By Microsoft MimeOLE V6.0.6000.16480
|> X-MS-CommunityGroup-PostID: {1E193615-B639-4F29-848B-206674D75DD7}
|> X-RFC2646: Format=Flowed; Original
|> X-MS-CommunityGroup-ThreadID: F3B5FBBF-920E-42E4-AF25-5D88C62A9071
|> X-MS-CommunityGroup-ParentID: 7B187BD4-9DA5-4B5C-88F0-C4CDBA233020
|> Newsgroups: microsoft.public.windows.vista.general
|> Path: TK2MSFTNGHUB02.phx.gbl
|> Xref: TK2MSFTNGHUB02.phx.gbl
microsoft.public.windows.vista.general:134232
|> NNTP-Posting-Host: TK2MSFTNGHUB02.phx.gbl 127.0.0.1
|> X-Tomcat-NG: microsoft.public.windows.vista.general
|>
|> > The autoexec.bat is not run, however it will be parsed during startup
so
|> > that environment variables will be picked up.
|> > Commands in there are not run so the subst would be processed.
|> > However entries like path statements should be parsed as would items
like
|> > set statements where you would be setting variables.
|> > These entries should be appended to list of environment variables set
by
|> > the system.
|>
|>
|> Hi Darrell
|>
|> Well, you know I love you as a PSS brother-in-arms (retired, in my
case).
|> But I must respectfully disagree, on this particular matter.
|>
|> It is pretty easy to verify. On a Vista machine, edit C:\AUTOEXEC.BAT to
|> contain the following lines:
|>
|> REM ************ top ***************
|> SET FOO=BAR
|> SUBST U: C:\Users
|> PATH=%PATH%;C:\Users
|> REM ************ end ***************
|>
|> Now, reboot and log in.
|> Open a command prompt.
|> Run a "SET" command.
|> Observe that no %FOO% var is defined.
|> Ditto, no C:\Users has been appended to the %PATH%
|> And to confirm the SUBST had no effect, go to U: drive and observe the
"The
|> system cannot find teh drive specified" error mesage.
|>
|> In short, Windows has totally ignored the C:\autoexec.bat file. This is
a
|> Good Thing: autoexec.bat would be a vector for a million securty
exploits,
|> otherwise.
|>
|> Just for completeness, add a line to C:\Windows\System32\Autoexec.nt
saying
|> SET BAZ=BAR16
|> and reboot the system. Now go to a command prompt and do SET. Observe
there
|> is no %BAZ% variable; again the Win32 system has ignored this value. Now
run
|> the command "command" to start a COMMAND.COM session. Type a SET
command,
|> This will show you the environment for the 16-bit NTVDM, created to host
|> COMMAND.COM. Here, there *is* a variable %BAZ%, equal to BAR16. So the
NTVDM
|> does honour the autoexec.nt file - but not the C:\auotexec.bat.
|>
|> I'm happy to be proved wrong
but that's how it looks to me (and how
I
|> understand Windows to work).
|>
|> Best regards
|> Andrew
|>
|>
|>
|>