Comprehensive Guide to Using the Command Prompt for File and Directory
Absolute and Relative File Paths
File paths can be either absolute or relative:
- Absolute paths point to a specific location in the file system, starting from the root directory, regardless of the current working directory or other factors.
- Relative paths are defined concerning the current working directory of the user or application.
Navigating Directories
To move from one directory to a subdirectory, use the following command:
cd [directory]
To move up from a subdirectory to its parent directory, use:
cd..
Changing Drives (Windows)
To switch to another drive, enter the drive letter followed by a colon:
D:
Essential Command Line Operations
-
Open Command Prompt:
Use the shortcut Windows + R, then typecmd
. -
Request Command Help:
Enter the command: - List All Folder Contents:
Use the command:
dir
-
Use the ↑ (Up Arrow) and ↓ (Down Arrow) keys to scroll through previous commands.
-
Autocomplete Folder Contents:
Press the Tab key to cycle through items in the current directory. Use Shift + Tab to cycle in reverse. -
Filter by Initial Letters:
Type a letter or sequence of letters and press Tab to see files and folders starting with those characters (e.g., "s" forsystem
,system32
,system.ini
, etc.).
Creating and Running Batch Files
You can create script files with the extensions:
.bat
(for Windows).sh
(for Linux).
These files can contain multiple commands and be executed via the command line or file explorer.
Note: When running from File Explorer, the Command Prompt window will close immediately after execution. To keep it open and view the output, add the following line at the end of your file:
pause
Курс 'Java для начинающих' на Udemy
Please log in or register to have a possibility to add comment.