Hi there
i'm new to batch scripting and currently writing a file which performs some action
I have the following questions, can u please guide me on them
1. I need to set the following path on another server( say for ex: server B and C) from my local machine (say for ex: server A)
I have managed to understand and get right the following command i.e.
set PATH=%SystemRoot%\Microsoft.NET\Framework\v2.0.50727;%PATH%
2. By default when u run this batch file from your local machine, i don't what is the current directory so i need to navigate to the following directory i.e.
cd "c:\Program Files\Folder1\Software1"
please guide me
regards
Setting environment vars and change dirs - Please help
Moderator: DosItHelp
Re: Setting environment vars and change dirs - Please help
I have learnt by experience that you invite disaster with
cd "c:\Program Files\Folder1\Software1"
you really need
cd /D "c:\Program Files\Folder1\Software1"
The /D option changes the DRIVE/PARTITION as well as the folder/file path
Without /D then if your current Drive is X:\ and your current directory is root of X:\, then
cd "c:\Program Files\Folder1\Software1"
is not going to affect your current position, and if the next command is
DEL *.*
it will not delete anything in "c:\Program Files\Folder1\Software1"
but will destroy the entire contents of X:\
The above is my experience on a solitary computer.
I am sure that you will encounter more complications working across a network.
Alan
cd "c:\Program Files\Folder1\Software1"
you really need
cd /D "c:\Program Files\Folder1\Software1"
The /D option changes the DRIVE/PARTITION as well as the folder/file path
Without /D then if your current Drive is X:\ and your current directory is root of X:\, then
cd "c:\Program Files\Folder1\Software1"
is not going to affect your current position, and if the next command is
DEL *.*
it will not delete anything in "c:\Program Files\Folder1\Software1"
but will destroy the entire contents of X:\
The above is my experience on a solitary computer.
I am sure that you will encounter more complications working across a network.
Alan