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,
- How to use SSH in Windows Terminal
- Mac: Sign in Required We cant upload or download your changes because your cached credentials have expired [Word Excel]
- [Fix] Microsoft Windows Store error 0x00000005 (Windows 8/10/11)
- How to Create Awesome Quizzes using Windows 365 Forms
- Cannot access Windows application shortcuts on Start menu and Taskbar
- How to lock cells in Microsoft Excel for Mac
- How to locate Python Installation on Windows (10/11)
- [Solution] The connection to the remote PC was lost, preparing to reconnect - Windows RDP
- Fix: Error code: 0x204 Microsoft Remote Desktop - Unable to connect the remote PC.
- How to Repeat Last Action F4 on Excel on Mac Like Windows
- Grep Alternative for Windows CMD or PowerShell: findstr
- Read file from Windows CMD (Command Line)
- Office.com downloading zero byte file name prelanding on Safari browser
- How to Press a Enter in Cell for New Line on Microsoft Excel on Mac
- Cmd command get current directory location
- How to update Microsoft Excel on Mac
- [Fix] Microsoft Windows OneDrive 0x8007018b Error Code
- How to Insert Checkbox in Excel on Mac
- How to turn off Dark Mode in Excel App for Mac
- Minecraft Fix: Error: UNKNOWN code: Deep Ocean - Something went wrong in the login process
- Fix Windows Update Error Code: 0x80070643
- Windows 365: Restore Deleted Distribution Group using Admin Center (Active Directory)
- How to add Solver Add-in in Microsoft Excel on Mac
- sudo is not recognized as an internal or external command
- How to Freeze Top Row in Excel for Mac
More Posts:
- Fix SharePoint Error - The Managed Metadata Service or Connection is currently not available. The Application Pool or Managed Metadata Web Service may not have been started - SharePoint
- Outlook and Hotmail not working - email issue, message not delivered, send receive problem - Microsoft
- Set width and height for the label in tkinter - Python
- How to install zsh shell on Ubuntu - Ubuntu
- AlertDialog with image using ImageView Example - Android
- Bash - How to check if a Command Failed? - Bash
- Android Studio: Cannot perform refactoring operation - Android-Studio
- MainActivity error: cannot find symbol FloatingActionButton - Android