In PowerShell, Navigation Commands are used to navigate around the filesystem like the command prompt, Unix, and Linux in the interactive session. There are five commands in PowerShell that help to navigate around the filesystem. In this article, we are going to see how to use these PowerShell Navigation commands in detail. Pushd, cd, dir, pws, and popd are the five main commands. Let’s see these commands in detail. In these five commands, Pushd and popd are related these commands are available on command-line interpreters such as DOS, Bash, C shell, tcsh, cmd, and PowerShell.
PowerShell Navigation commands:
Â
pushd –> pushd command stores the current directory. Every time you use the pushd command then it stores a single directory for future use. These directories are stored sequentially in a virtual stack. You can also use this pushd command multiple times. For example, if you type this pushd command for the first time then it stores that particular directory, then if you move to a different directory and then if you type the same pushd command then it stores the second directory in sequential order.
Popd –> popd command changes the current directory to the directory that was most recently stored by the pushd command. Once you store the current directory by typing the pushd command then you can retrieve the directory by typing the popd command. If you use pushd command multiple times then it will store the directory path in sequential order in a virtual stack. Then you can type popd command to retrieve the directory in order.
Cd –> cd command is one of the most useful and frequently used command. It displays the name of the current directory or changes the current directory. There are many ways to use this command.
- Cd\ –>Changes the directory to the root directory
- Cd D: –>Change the current drive to different drive
- Cd –>Change the current path to the directory you want
- Cd .. –>change to the parent folder.
Dir –> This command Displays the disk volume label and serial number, followed by a list of directories and files on the disk including the file names and the date and time each was last modified.
Pwd –> Display the current path.Â