Computer Hope

Microsoft => Microsoft DOS => Topic started by: x3g on March 18, 2009, 01:52:26 PM

Title: Pls help with path independent batch files
Post by: x3g on March 18, 2009, 01:52:26 PM
hey all
I have some UNC paths in my batch files that do not exist at other network locations. I'm wondering if there's a way to get rid of the paths so that my coworkers dont have to modify the batch files to match their network drive mapping.
thanks,
Title: Re: Pls help with path independent batch files
Post by: DaveLembke on March 18, 2009, 02:59:29 PM
Can you please share code so we can see what you are trying to achieve.... probably going to want to create a path that points to C:\somefolder to make universal
Title: Re: Pls help with path independent batch files
Post by: x3g on March 18, 2009, 03:28:04 PM
The batch file is a silent install which runs an MSI off a network share, the path to the msi is something like this
\\servername\xxx\xxxxx\install.msi
If somehow I can get rid of the specific location infront of the msi then I can distribute the script to other support folks so they can run the silent install without having to change the path to match their network share.
thanks,
Title: Re: Pls help with path independent batch files
Post by: BatchFileCommand on March 18, 2009, 03:55:25 PM
I don't quite know what you are doing. But here are the system-set variables.


Code: [Select]
ALLUSERSPROFILE = C:\ProgramData

APPDATA = C:\Users\username\AppData\Roaming

CommonProgramFiles = C:\Program Files\Common Files

COMPUTERNAME = LAPTOPCOMPUTER

ComSpec = C:\Windows\system32\cmd.exe

FP_NO_HOST_CHECK = NO

HOMEDRIVE = C:

HOMEPATH = \Users\username

LOCALAPPDATA = C:\Users\username\AppData\Local

LOGONSERVER = \\LAPTOPCOMPUTER

NUMBER_OF_PROCESSORS = 2

OS = Windows_NT

PROCESSOR_ARCHITECTURE = x86

PROCESSOR_IDENTIFIER = x86 Family 6 Model 15 Stepping 13, Genuin

PROCESSOR_LEVEL = 6

PROCESSOR_REVISION = 0f0d

ProgramData = C:\ProgramData

ProgramFiles = C:\Program Files

PROMPT = $P$G

PUBLIC = C:\Users\Public

SESSIONNAME = Console

SystemDrive = C:

SystemRoot = C:\Windows

TEMP = C:\Users\username\AppData\Local\Temp

TMP = C:\Users\username\AppData\Local\Temp

USERDOMAIN = LaptopComputer

USERNAME = username

USERPROFILE = C:\Users\username

windir = C:\Windows




The results vary, but those are variables that are set by the system. 
Title: Re: Pls help with path independent batch files
Post by: x3g on March 18, 2009, 04:38:31 PM
I wasn't looking for a system variable but thanks for your reply.