If you want to know the current location, in which folder or directory you are while using Windows CMD (Command Line Interface), you can make use of cd command,
Command: cd - This command can be used to displays the name of or to change the current directory.
Example:
D:\Games>cd
D:\Games
D:\Games>
Know Current Location in CMD
If you want to print the current location in a Shell Script you can wrap the cd with percentage sign example %cd%,
Example:
D:\Games>echo "Current Location is %cd%"
"Current Location is D:\Games"
@echo off
set location=%cd%
echo Your current dir is %location%
pause
Output:
C:\Users\C2c\Desktop>sample.bat
Your current dir is C:\Users\C2c\Desktop
Press any key to continue . . .
More Posts related to Windows,
- Grep Alternative for Windows CMD or PowerShell: findstr
- Fix Windows Update Install Error 0x80070005
- Read file from Windows CMD (Command Line)
- Cannot access Windows application shortcuts on Start menu and Taskbar
- sudo is not recognized as an internal or external command
- Minecraft Fix: Error: UNKNOWN code: Deep Ocean - Something went wrong in the login process
- Cmd command get current directory location
- [Fix] Microsoft Windows OneDrive 0x8007018b Error Code
- [Solution] The connection to the remote PC was lost, preparing to reconnect - Windows RDP
- [Fix] Microsoft Windows Store error 0x00000005 (Windows 8/10/11)
- Fix Windows Update Error Code: 0x80070643
- Fix: Error code: 0x204 Microsoft Remote Desktop - Unable to connect the remote PC.
More Posts:
- How to Change Eclipse Default Web Browser - Eclipse
- How to install tabnine on VS Code - HowTos
- How to Center Align Image in Bootstrap - CSS
- Connection Failed: 1130 PHP MySQL Error - MySQL
- Java SE 8 Update 301 available with various bug fixes and security improvements - Java
- Microsoft Teams Error code - 6 issue - Teams
- 11 Weeks of Android Online Sessions-15-Jun-to-28-Aug-2020 - Android
- Increase Android Emulator Timeout time - Android