Command Prompt has been substituted by a more versatile version called the Windows PowerShell. Windows PowerShell consists of command line shell and scripting language. Windows PowerShell is an open-source and cross-platform application launched on Windows 10 along with the introduction of PowerShell Core. There are many commands, which are common to both Command Prompt and Windows PowerShell. Check them out!
- For navigating to any location on the command line, for Command Prompt, you used the CD, but in case of PowerShell, use the following.
Set-Location "<PATH>"
- When you want to list down all the contents of a folder by navigating through a tree of directories, use the following command for Windows PowerShell. (For Command Prompt, we used dir)
Get-ChildItem
- For setting variables, the Command Prompt command would be
SET VariableName = "Value of the Variable"
whereas for Windows PowerShell, $ is an important syntax and the command turns out to be the following.
$VariableName="Value of the Variable"
- If you want to join a computer to a domain, the Command Prompt command is
netdom /domain:domainName /user:userName /password:passwordForTheDomain member hostname /add
for PowerShell, it changes to
Add-Computer -DomainName "Domain" -Credential "Domain\Username" -Restart
- If any change has been made to the Local Group Policy, you need to force refresh the Group Policy in order to check what new changes have been to the Group Policy. The command for Command Prompt is
gpupdate /force
For PowerShell, one can use
Invoke-GPUpdate -Computer "Name of the Host" -Force
- If you want to gather information about a particular command then for Command Prompt, you can use the following command
command /?
For PowerShell, if you want to know what function does a cmdlet does, then use
Get-Help "CMDLET NAME"
- The Command Prompt command for shutting down a computer is
shutdown -r,
the command equivalent for PowerShell is
Restart-Computer -ComputerName "HostNameNew", Gateway or Address"
- If you want to shut down a remote computer or a server session, then for Command Prompt, use the following command
shutdown -s
For PowerShell, use the following command.
Stop-Computer -ComputerName "HostName1","HostName2","Gateway or Address"
- When you have to rename a file or a folder on a remote system, for command Prompt, use the command rename
But for PowerShell, use the following
Rename-Item "Path/of/the/file.txt" - NewName "NewNameOfTheFile.csv"
To stop a running process, you do not need to rely on Task Manager any more. Windows PowerShell is self sufficient. For Command Prompt, you can use the taskkill is a reliable command on the Command Prompt, but with PowerShell, you can use
Stop-Process -Name "ApplicationName.exe"