3 Methods to Get Current Working Directory on Windows

3 Methods to Get Current Working Directory on Windows

When working with files and directories via command line on Windows, may be useful to determine current working directory. It is directory in which the user is currently working in. This tutorial shows how to get current working directory on Windows.

Method 1 - cd command in CMD

Execute cd command without any arguments to print the full path to the current working directory.

$ cd

Method 2 - CD environment variable in CMD

The CD environment variable stores the full path to the current working directory. It can be printed as follows:

echo %CD%

Method 3 - PowerShell

The Get-Location command allows to get information about the current directory in PowerShell.

(Get-Location).Path

Leave a Comment

Cancel reply

Your email address will not be published.