How to print current directory name via MS-DOS commands

86,299

Just use cd with no arguments supplied. From cd /?:

Type CD without parameters to display the current drive and directory.

Share:
86,299
NoWar
Author by

NoWar

[email protected]

Updated on August 08, 2020

Comments

  • NoWar
    NoWar almost 4 years

    I need to print current directory name after CD command.

    Is it possible to do? Thanks!

    echo off
    echo. 
    echo This batch program deletes some files  
    echo. 
    
    pause
    
    cd "D:\Folder1\"  
    
    pause 
    
  • kayleeFrye_onDeck
    kayleeFrye_onDeck over 8 years
    And if you're trying to do more with the current directory as a value than simply printing it to console, use %cd% to access the environment variable.