Strange Path Behavior

B

Bennett Price

My PC is a dual boot, Win95 and Win XP Pro SP1.

My c:\autoexec.bat has a path statement. If I shell to DOS in WinXP and
issue the path command, I see both the XP path
(defined in My Computer/Properties/Advanced/Environment) appended by
the path defined in c:\autoexec.bat.

But, I have no path statement or command in autoexec.nt (or config.nt).
A string search in the XP Registry for Win95 path statements returns
nothing.
No local path or profile is set for me (in Computer Management / Local
Users and Groups / Users / Me / Profile.

So how is the DOS path being added to the XP path?
 
D

David Candy

XP reads path statements from Autoexec.bat (and config.sys) (at user logon not startup).

Only path, set, and prompt are read. Also any standard variable is not over written by these (which makes it pretty useless as Prompt is already set), though path is appended.
 
B

Bennett Price

Thanks for your reply. I'm really puzzled though. Everything I read
about autoexec.nt says that it will only read a path statement in
autoexec.bat if the command "PATH" is in autoexec.nt. I've been unable
to find anything that distinguishes this behavior in re startup vs. login.

The only thing I haven't been able to figure out at all is how to look
at the behavior of 'default user'. Perhaps there there is something
that says what to do about autoexec.bat
 
D

David Candy

I've not ever read that about Path. There is some documentation that says the path is only used by NTVDM (dos and win3.1) but there's plenty more that contradicts that.

Config.sys is done one by setup.

How Windows NT Uses MS-DOS Configuration Files
During system startup, Windows NT adds any Path, Prompt, and Set commands from the C:\Autoexec.bat file to the Windows NT environment variables and then ignores the rest of the contents of C:\Autoexec.bat and C:\Config.sys. If these files are not present when you install Windows NT, the Setup program creates them. Setup also creates default Autoexec.nt and Config.nt files.


The path and other Windows NT environment information are stored under the following Registry key:

HKEY_LOCAL_MACHINE\System
\CurrentControlSet
\Control
\Session Manager
\Environment

When an MS-DOS-based application is started, Windows NT executes files specified in the application's program information file (PIF) or the Autoexec.nt and Config.nt files in the Systemroot\System32 directory. Any changes made in one of these files take effect as soon as the file is saved and a new MS-DOS-based application is started that uses that file. You do not need to restart your system after changing the .nt files. Windows NT uses these files as follows:

Files
Use in Windows NT



C:\Autoexec.bat
Path and environment variables are added to the Windows NT environment at system startup.

C:\Config.sys
Not used by Windows NT.

Autoexec.nt and Config.nt
in Systemroot\System32
Used every time an MS-DOS-based application is run with _Default.pif. (Custom .nt files can be created and used when starting an application from another PIF.)






You can use any text editor to view the contents of the Autoexec.nt and Config.nt files.

Commands in the Autoexec.bat and Config.sys files for starting applications and initializing drivers are ignored in Windows NT.

a.. To run an application automatically when you start Windows NT, use the Taskbar option on the Start menu to place a shortcut to the application in the Taskbar Startup group. For more information, see Windows NT Start Here.
b.. To run a service or driver automatically, use the Services option in Control Panel: In Control Panel, double-click Services. Select a service from the list, then click the Startup button. In the Startup type field of the Service dialog box, click Automatic, then click OK. This setting is saved as the Start value in the service's subkey under HKEY_LOCAL_MACHINE\System\CurrentControlSet\Services in the Registry.



--------------------------------------------------------------------------------

From Win2000 Resource Kit
Changing System Environment Variables
Environment variables specify the computer's search path, directory for temporary files, and other similar information.

Windows NT 4.0 requires specific information to find programs, to allocate memory space for some programs to run, and to control various programs. You can view this information - called the system and user environment variables - in Control Panel. Under the System icon in Control Panel, click the Advanced tab , and then click Environment Variables. These environment variables are similar to those that you can set in the MS-DOS operating system, such as Path and Temp.

User environment variables can be different for each user of a particular computer. They include any environment variables you define or variables that are defined by applications, such as the path where application files are located.

System environment variables are defined by Windows 2000 Professional and are the same no matter what user is logged on at the computer. If you are logged on as a member of the Administrators group, you can add new variables or change the values.

After you change any environment variables, Windows 2000 Professional saves the new values in the registry so they are available automatically the next time the computer starts.

If any conflict exists between environment variables, Windows 2000 Professional resolves the conflict in this way:

a.. System environment variables are set first.
b.. User environment variables are set next and override conflicting system variables.
c.. Variables that are defined in Autoexec.bat are set last, but they do not override conflicting system or user environment variables.
Note Path settings, unlike other environment variables, are cumulative. The full path that you see when you type path at the command prompt is created by appending the path that is contained in Autoexec.bat to the paths that are defined in the System Properties sheet under System in Control Panel.
 
D

David Candy

PS when XP was in beta I dual installed it with ME. It read my ME path in Autoexec and wierd stuff happened. ME's msconfig would start for one.

Autoexec parsing can be turned off.
HKEY_CURRENT_USER\Software\Microsoft\Windows NT\CurrentVersion\Winlogon
set ParseAutoexec to 0 as a text value.

According to tweakui
273, "If the \"Parse Autoexec.bat at logon\" box is checked, then the Autoexec.bat file will be scanned for SET commands and the variables found will be set in the user's environment.\n\nThis is a per-user setting."
--
----------------------------------------------------------
http://www.g2mil.com/Dec2003.htm
I've not ever read that about Path. There is some documentation that says the path is only used by NTVDM (dos and win3.1) but there's plenty more that contradicts that.

Config.sys is done one by setup.

How Windows NT Uses MS-DOS Configuration Files
During system startup, Windows NT adds any Path, Prompt, and Set commands from the C:\Autoexec.bat file to the Windows NT environment variables and then ignores the rest of the contents of C:\Autoexec.bat and C:\Config.sys. If these files are not present when you install Windows NT, the Setup program creates them. Setup also creates default Autoexec.nt and Config.nt files.


The path and other Windows NT environment information are stored under the following Registry key:

HKEY_LOCAL_MACHINE\System
\CurrentControlSet
\Control
\Session Manager
\Environment

When an MS-DOS-based application is started, Windows NT executes files specified in the application's program information file (PIF) or the Autoexec.nt and Config.nt files in the Systemroot\System32 directory. Any changes made in one of these files take effect as soon as the file is saved and a new MS-DOS-based application is started that uses that file. You do not need to restart your system after changing the .nt files. Windows NT uses these files as follows:

Files
Use in Windows NT



C:\Autoexec.bat
Path and environment variables are added to the Windows NT environment at system startup.

C:\Config.sys
Not used by Windows NT.

Autoexec.nt and Config.nt
in Systemroot\System32
Used every time an MS-DOS-based application is run with _Default.pif. (Custom .nt files can be created and used when starting an application from another PIF.)






You can use any text editor to view the contents of the Autoexec.nt and Config.nt files.

Commands in the Autoexec.bat and Config.sys files for starting applications and initializing drivers are ignored in Windows NT.

a.. To run an application automatically when you start Windows NT, use the Taskbar option on the Start menu to place a shortcut to the application in the Taskbar Startup group. For more information, see Windows NT Start Here.
b.. To run a service or driver automatically, use the Services option in Control Panel: In Control Panel, double-click Services. Select a service from the list, then click the Startup button. In the Startup type field of the Service dialog box, click Automatic, then click OK. This setting is saved as the Start value in the service's subkey under HKEY_LOCAL_MACHINE\System\CurrentControlSet\Services in the Registry.



--------------------------------------------------------------------------------

From Win2000 Resource Kit
Changing System Environment Variables
Environment variables specify the computer's search path, directory for temporary files, and other similar information.

Windows NT 4.0 requires specific information to find programs, to allocate memory space for some programs to run, and to control various programs. You can view this information - called the system and user environment variables - in Control Panel. Under the System icon in Control Panel, click the Advanced tab , and then click Environment Variables. These environment variables are similar to those that you can set in the MS-DOS operating system, such as Path and Temp.

User environment variables can be different for each user of a particular computer. They include any environment variables you define or variables that are defined by applications, such as the path where application files are located.

System environment variables are defined by Windows 2000 Professional and are the same no matter what user is logged on at the computer. If you are logged on as a member of the Administrators group, you can add new variables or change the values.

After you change any environment variables, Windows 2000 Professional saves the new values in the registry so they are available automatically the next time the computer starts.

If any conflict exists between environment variables, Windows 2000 Professional resolves the conflict in this way:

a.. System environment variables are set first.
b.. User environment variables are set next and override conflicting system variables.
c.. Variables that are defined in Autoexec.bat are set last, but they do not override conflicting system or user environment variables.
Note Path settings, unlike other environment variables, are cumulative. The full path that you see when you type path at the command prompt is created by appending the path that is contained in Autoexec.bat to the paths that are defined in the System Properties sheet under System in Control Panel.
 
B

Bennett Price

Thanks so much Mystery solved. The answer is in my TweakUI which had
'parse autoexec.bat at logon' turned on; I hadn't thought to look there.

NT and XP apparently are different in how they handle autoexec.bat:

From XP's 'Help and Support' / Search 'set path'

.. Searching the MS-DOS subsystem

If you place the path command in your Autoexec.nt file, it automatically
appends the specified MS-DOS subsystem search path to the Windows XP
search path every time you log on to your computer. Cmd.exe does not use
the Autoexec.nt file. When started from a shortcut, Cmd.exe inherits the
environment variables set in
My Computer/Properties/Advanced/Environment.

From the boilerplate in XP's autoexec.nt"
REM AUTOEXEC.BAT is not used to initialize the MS-DOS environment.
REM AUTOEXEC.NT is used to initialize the MS-DOS environment unless a
REM different startup file is specified in an application's PIF.

Thanks again for your help.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top