Get current directories

Discussion forum for all Windows batch related topics.

Moderator: DosItHelp

Post Reply
Message
Author
Q. April
Posts: 19
Joined: 27 Jan 2018 14:36
Location: Mayatopia

Get current directories

#1 Post by Q. April » 10 Dec 2018 15:53

What a simple way to get current directories

Code: Select all

@echo off>Temp&for %%a in ("Temp.*") do ( set "_Dir=%%~par" )&Del Temp
It worked ,but the code really long , any simple way to do it?

ShadowThief
Expert
Posts: 892
Joined: 06 Sep 2013 21:28
Location: Virginia, United States

Re: Get current directories

#2 Post by ShadowThief » 10 Dec 2018 15:55

Code: Select all

echo %CD%

Q. April
Posts: 19
Joined: 27 Jan 2018 14:36
Location: Mayatopia

Re: Get current directories

#3 Post by Q. April » 10 Dec 2018 16:00

:D thanks

Squashman
Expert
Posts: 4106
Joined: 23 Dec 2011 13:59

Re: Get current directories

#4 Post by Squashman » 10 Dec 2018 16:15

You can also just type the CD command.

Code: Select all

H:\temp\temp>cd
H:\temp\temp

Post Reply