Discussion forum for all Windows batch related topics.
Moderator: DosItHelp
-
©opy[it]®ight
- Posts: 60
- Joined: 17 Mar 2012 09:59
#31
Post
by ©opy[it]®ight » 04 Sep 2012 07:19
What i meant:
Will the command
CD folder be executed/interpreted different than when doing
CD \folder or
CD folder\?

and for batch:
Will
IF EXIST folder\ be executed/interpreted different than
IF EXIST \folder\ ?
-
foxidrive
- Expert
- Posts: 6031
- Joined: 10 Feb 2012 02:20
#32
Post
by foxidrive » 04 Sep 2012 08:09
When changing folders they can be relative to the current folder, or explicit with the full path.
For EG: if you are in c:\admin and there is a folder called c:\admin\work
then because you are in c:\admin already then you can execute
cd work
But if you are in c:\program files and need to change to c:\admin\work then you execute
cd \admin\work
or if you are in d: drive then you can execute
cd /d c:\admin\work
-
foxidrive
- Expert
- Posts: 6031
- Joined: 10 Feb 2012 02:20
#33
Post
by foxidrive » 04 Sep 2012 08:12
©opy[it]®ight wrote:and for batch:
Will IF EXIST folder\ be executed/interpreted different than IF EXIST \folder\ ?
The trailing slash is needed because without one it can match a file as well.
Again your example raises the relative vs explicit path issue.
The first example will only check for "folder" in the current working directory.
-
©opy[it]®ight
- Posts: 60
- Joined: 17 Mar 2012 09:59
#34
Post
by ©opy[it]®ight » 20 Sep 2012 08:40
Oops, i didn't notice i had new replies. Thanks for clearing that up. It all makes sence to me now
