Need to write a .bat file that when it runs, displays my current directory

I am new to .bat files. I just need to make one that will run and display the directory i'm in. Can anyone help me out?


@echo off
echo Your current directory is
dir C:/windows
pause

Open in new window


was my starting point
Mark_CoAsked:
Who is Participating?
 
oBdACommented:
Wait; do you mean "show the current directory", or "show the content of the current directory"? From your example, it's not quite clear; some examples:
@echo off
echo Your current directory is %cd%
echo The content of the current directory:
dir
The content of the folder this script is in:
dir "%~dp0"
The content of the Windows folder:
dir "%Systemroot%"
pause

Open in new window

0
 
oBdACommented:
@echo %cd%

Open in new window

0
 
Bill PrewCommented:
Building off what you had:

@echo off
echo Your current directory is:
echo %CD%
pause

Open in new window

~bp
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.