Windows PowerShell is powerful and can do almost everything that a person wants on his computer. But the only problem is that it is a command line tool and does not have GUI. However, it can be helpful when the GUI-based interface fails or stops responding. Unfortunately, the main thing is that a regular user lacks the knowledge of using PowerShell to its full potential. But today, we will be trying to discuss the top 10 PowerShell commands that can help a user do more on Windows 10.
PowerShell commands that will help a user do more
Before we begin, it needs to be highlighted that some of these cmdlets might toggle certain settings or configurations on your computer. A cmdlet is a PowerShell script that performs a single function. So, to be on the safer side, create a System Restore point first. If something goes wrong during trying one of the following cmdlets, you can always restore your computer.
We will be taking a look at cmdlets that can do the following:
- Launch a UWP Application.
- Get Help regarding any cmdlet.
- Get similar commands.
- Find a particular file.
- Read the contents of a file.
- Find information about all the services on a computer.
- Find information about all the processes on a computer.
- Setting the Execution Policy.
- Copy a file or a directory.
- Delete a file or a directory.
1] Launch a UWP Application
PowerShell is a great tool that can be used to launch UWP Applications within seconds. But the main thing lies in the proper execution of a command. You can use
Start-Process "ms-settings:"
the command to launch the Windows Settings UWP Application. You can learn more about other URIs for other UWP Applications here on microsoft.com.
2] Get Help regarding any cmdlet
Suppose you are ever stuck confused about what command you must be used to execute a specific task. Or what a specific cmdlet does, you do not need to worry about. You can use the Get-Help cmdlet to do it. You can use it in the following ways-
Get-Help Get-Help <command name> Get-Help <command name> -Full Get-Help <command name> -Example Get-Help *
Here, the first entry will guide you on how to use this cmdlet. The second entry will give you a simple summary of the particular cmdlet. The third entry will give detailed information about the respective cmdlet. The fourth entry will comprise everything that the third cmdlet shows but will add an example of how to use that cmdlet. And finally, the fifth cmdlet will list every command that is available for your use.
3] Get Similar Commands
To find commands of a similar type or that contain a particular phrase in them, you can use the Get-Command cmdlet. However, it does not list out every cmdlet in PowerShell, so you make use of some particular filters. You can use the following commands-
Get-Command -Name <name> Get-Command -CommandType <type>
The first cmdlet will help you find a cmdlet with a particular phrase in it, whereas the second one will enable you to filter out cmdlets that perform a particular function.
4] Finding a particular file
If you need to find a particular file or a directory for a specific location, you can use the Get-Item cmdlet. You can use it as
Get-Item <PATH>
to list out the contents of the particular path.
5] Read the contents of a file
If you need to read the contents of a file, you can use the Get-Content command as-
Get-Content <PATH of the file with its extension>
6] Read information about all the services on a computer
You can use the Get-Service cmdlet to list all the services running or stopped on your computer. Alternatively, you can use the following related cmdlets to do their respective functions-
Start-Service <Service Name> Stop-Service <Service Name> Suspend-Service <Service Name> Resume-Service <Service Name> Restart-Service <Service Name>
7] Read information about all the processes on a computer
Similar to the Get-Service cmdlet, you can use the Get-Process cmdlet to list all the Processes running on your computer. Alternatively, you can use the following related cmdlets to do their respective functions,
Start-Process <Process Name> Stop-Process <Process Name> Wait-Service <Process Name>
8] Setting the Execution Policy
While there is support for creating and executing scripts on PowerShell, there are restrictions to each one of them as a part of some security measures. You can toggle the Security level to any of the four levels. You can use the Set-ExecutionPolicy cmdlet followed by any of the security levels given as-.
Set-ExecutionPolicy Unrestricted Set-ExecutionPolicy All Signed Set-ExecutionPolicy Remote Signed Set-ExecutionPolicy Restricted
Here, the policies from top to bottom range from lowest to the highest level of security.
9] Copy a file or a directory
A user can make use of the Copy-Item cmdlet to copy one file or directory to another destination. The syntax for this cmdlet is-
Copy-Item "E:\TWCTest.txt" -Destination "D:\"
10] Delete a file or a directory
Similar to the Copy-Item cmdlet, A user can make use of the Copy-Item cmdlet to copy one file or directory to another destination. The syntax for this cmdlet is-
Remove-Item "E:\TWCTest.txt"
Do you have any other useful cmdlets to share with all of us? Feel free to write them down in the comment box below.
How do I get a list of PowerShell commands?
There are over 200 commands available with PowerShell. If you want to know each of them, you can use the Get-Command to list all the PowerShell modules, aliases, and commands. If you’re going to save the list, output the command to a text file on the computer and save it. You can open it in excel and then categorize them.
What is the difference between CMD and PowerShell?
PowerShell is an advanced version of cmd. Besides being an interface, it is also a scripting language used to facilitate the system’s administration. Along with this, you can also use the Command Prompt commands in PowerShell. In Windows 11, you have access to Windows Terminal, which offers both Command Prompt and PowerShell.