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>
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,
- Fix Windows Update Error Code: 0x80070643
- How to Create Awesome Quizzes using Windows 365 Forms
- [Fix] Microsoft Windows Store error 0x00000005 (Windows 8/10/11)
- Windows 365: Restore Deleted Distribution Group using Admin Center (Active Directory)
- How to Change Encoding of File from ANSI to UTF-8 in Windows Notepad
- How to Change the Default Shell in Windows Terminal App
- How to Create a Website (Webpage) using HTML on Windows Notepad
- How to Find the Location of Notepad on Windows 11
- How to locate Python Installation on Windows (10/11)
- Top 5 Fonts for Windows Notepad
- Fix: Windows Update Error Code: 0x800f0922
- Office.com downloading zero byte file name prelanding on Safari browser
- How to Search in Notepad Application on Windows
- Cannot access Windows application shortcuts on Start menu and Taskbar
- How to add Solver Add-in in Microsoft Excel on Mac
- How to Freeze Top Row in Excel for Mac
- [Fix] Microsoft Windows OneDrive 0x8007018b Error Code
- Mac: Sign in Required We cant upload or download your changes because your cached credentials have expired [Word Excel]
- Grep Alternative for Windows CMD or PowerShell: findstr
- Fix: Failed in attempting to update the source: winget
- How to lock cells in Microsoft Excel for Mac
- Enable Cloud Based Clipboard for Images and Text on Windows 10/11
- How to update Microsoft Excel on Mac
- How to Make a Windows Notepad File Read-Only
- sudo is not recognized as an internal or external command
More Posts:
- Quickly install VS Code on macOS Sonoma/Ventura - MacOS
- Read file from Windows CMD (Command Line) - Windows
- Health Status Page for OpenAI ChatGPT or GPT 4 - HowTos
- Share Image to WhatsApp with Caption from your Android App - WhatsApp
- PowerShell Alias Type Commands List for Mac - MacOS
- Get the Complete Sha256 Container ID for Docker Run Command - Docker
- Tesla hit by a complete network and mobile app outage - 23 Sept 2020 11am ET (US and Europe) - News
- Java: Convert Byte to Binary String Example - Java