PPRuNe Forums - View Single Post - Autoexec.nt & Path
View Single Post
Old 22nd Aug 2006, 21:23
  #6 (permalink)  
Mac the Knife

Plastic PPRuNer
 
Join Date: Sep 2000
Location: Cape Town
Posts: 1,898
Received 0 Likes on 0 Posts
XP deals with DOS programs in interesting ways....

First of all, there are actually two PATHs in XP - one for the user and one for the System

You can change these - Start/Settings/Control Panel/System/Advanced/Environmental Variables (down at the bottom)

Add the directory you need to the path in "User variables for seacue" if you want 'em just for your login or the path in "System variables" if you want them to be global.

But this is inefficient, the change is permanent and it's just more stuff for the sytem to hunt through as it goes about it's business.

BTW XP normally ignores AUTOEXEC.BAT completely. If you do a bit of Registry twiddling it will however parse SET commands and set environmental variables.

Registry Settings
User Key: [HKEY_CURRENT_USER\Software\Microsoft\Windows NT\CurrentVersion\Winlogon]
Value Name: ParseAutoexec
Data Type: REG_SZ (String Value)
Value Data: (0 = disabled, 1 = enabled)

So you can create an AUTOEXEC.BAT to set user/system variables, but again, this is inefficient, the change is permanent and it's just more stuff for the sytem to hunt through as it goes about it's business.

Zoink is quite right - this should add the path to seacue's variables (if you execute it from your login), but make it rather
set path= %PATH%;c:\blah\blah
You'd just have to run this from a command window and follow it immediately by invoking your program
C:\blah\blah\myprog.exe
variables set in a command window are not persistent (they evaporate when the command window is closed)

This is clumsy and there are other ways to do it.

Look at the PIF again.
Are you specifying the name of the program correctly on the "Cmd line" - C:\blah\blah\myprog.exe?
Are you specifying the starting directory of the program correctly in "Working" - C:\blah\blah\?

Try adding
set path = %path%;C:\blah\blah to AUTOEXEC.NT

BTW, you don't HAVE to use CONFIG.NT and AUTOEXEC.NT as they stand. You can write a customised CONFIG file and a customised AUTOEXEC file for your app. - just base them on the existing files and store them anywhere, but reference them in the PIF by an absolute path. They're just text files after all that Windows reads line by line - AFAIK it probably doesn't matter what you call 'em so long as they're plain text files.

But you can also forget the PIF and just write a batch file to launch DOS stuff if you don't need to do anything fancy in the way of setting up the DOS environment

@echo off
cls
rem set new path
set path = %PATH%;C:\blah\blah
c:\blah\blah\myprog.exe
rem this leaves C:\blah\blah messily on the path

OR

@echo off
cls
set oldpath = %path%
rem save the old path and set the new one
set path = %path%;c:\blah\blah
c:\blah\blah\myprog.exe
rem tidy up by resetting the old path
set path = %oldpath%

OR (using XP's extended batch systax)

@echo off
cls
rem This is BLAH.BAT (or BLAH.CMD)
rem Set new path
rem this is more elegant!
Setlocal
set path = %path%;C:\blah\blah
c:\blah\blah\myprog.exe
endlocal
rem path goes back to it's original value after Endlocal

Ooooh batch files! That takes me back! I remember writing assembler routines to track down the master copy of the environment and make batch changes to the environment permanent.....

Last edited by Mac the Knife; 22nd Aug 2006 at 21:39.
Mac the Knife is offline