You can run PowerShell commands directly from the Command Prompt by using the `powershell` command followed by the desired PowerShell command in quotes. Here’s an example:
powershell "Get-Process"
Understanding CMD and PowerShell
What is CMD?
Command Prompt, often referred to as CMD, is a command-line interpreter that allows users to execute commands and run various scripts on Windows operating systems. Known for its simplicity, CMD is widely used for basic file operations, system administration tasks, and troubleshooting. However, it is limited in its capability to handle more complex scripting and automation tasks, which is where PowerShell comes into play.
What is PowerShell?
PowerShell is a task automation and configuration management framework consisting of a command-line shell and an associated scripting language. Unlike CMD, PowerShell is built on the .NET framework, which allows it to handle complex data types, access .NET classes, and automate Windows administration tasks significantly more efficiently. Its advanced functionality includes cmdlets, which are specialized .NET classes designed for specific tasks, making it a powerful tool for users seeking advanced interoperability with system processes.

Starting PowerShell from CMD
Basic Syntax for Launching PowerShell
To launch PowerShell from CMD, you can simply enter the following command:
powershell
Upon executing this command, a new PowerShell window will open, allowing you to run PowerShell commands directly. This transition illustrates how seamlessly CMD can integrate with PowerShell, providing users with the ability to leverage the power of both command-line environments.
Adding Parameters to Your PowerShell Command
Running PowerShell Scripts
You might want to run a specific PowerShell script directly from CMD. For example, to execute a script located at `C:\path\to\your\script.ps1`, you would type:
powershell -ExecutionPolicy Bypass -File "C:\path\to\your\script.ps1"
In this command:
- -ExecutionPolicy Bypass: This parameter temporarily changes the execution policy for the session, allowing the script to run without restriction, which is particularly helpful if the script is unsigned.
- -File: This parameter specifies the path to the PowerShell script you wish to execute.
Running Inline PowerShell Commands
You can also execute inline commands directly from CMD. For example, to list all running processes, you would input:
powershell -Command "Get-Process"
Here, -Command allows you to run a specific Command in PowerShell without needing to open a new window. This is useful for quick tasks.

Running PowerShell in CMD as Administrator
Opening CMD as Administrator
To execute scripts that require elevated permissions, start CMD as an administrator. Right-click on the Command Prompt icon and select “Run as administrator.”
Running PowerShell as Administrator from CMD
When you need to open PowerShell with administrator privileges directly from CMD, you can use the following command:
powershell -Command "Start-Process PowerShell -Verb RunAs"
This command utilizes Start-Process to launch a new PowerShell session with administrative rights. The -Verb RunAs argument specifically requests elevated permissions, critical for performing tasks that affect system settings or access sensitive directories.

Call PowerShell from CMD with Arguments
Passing Arguments to PowerShell Scripts
When executing a PowerShell script that requires parameters, you can call it with arguments directly from CMD. For instance:
powershell -File "C:\path\to\your\script.ps1" -ArgumentList "arg1", "arg2"
In this command, -ArgumentList allows you to pass multiple arguments to your PowerShell script. Inside your script, you can access these arguments using the `$args` array, which makes it easier to handle dynamic input.

Best Practices for Calling PowerShell from CMD
Testing Before Running Scripts
It’s crucial to validate your PowerShell commands before executing them, especially for scripts that perform changes to the system. Using the -WhatIf parameter where applicable can help prevent undesired modifications. For example:
powershell -Command "Remove-Item 'C:\Folder\*' -WhatIf"
This command simulates the action without actually performing it, allowing you to confirm the outcome before execution.
Using Comments in Scripts
Adding comments within your PowerShell scripts improves readability and maintainability. For instance:
# This script retrieves system information
Get-ComputerInfo
By including comments, you can provide context or reasoning behind specific commands, making it easier for others (or yourself in the future) to understand the script.

Common Issues When Calling PowerShell from CMD
Troubleshooting Common Errors
One common issue encountered is the execution policy error, which prevents scripts from running. If you face this error, you can bypass the execution policy with:
powershell -ExecutionPolicy Bypass
This command temporarily allows scripts to run without restrictions for that session.
Ensuring Scripts are Executable
To ensure that your PowerShell scripts can be executed without issues, you may need to change the script execution policy. You can set it to a more permissive level by entering:
Set-ExecutionPolicy RemoteSigned
This command allows locally created scripts to run without signature verification while requiring downloaded scripts to be signed, thus balancing security and convenience.

Conclusion
Integrating PowerShell with CMD enhances your command-line capabilities and simplifies complex tasks. By understanding how to run PowerShell from CMD effectively, you can optimize your workflow and leverage the strengths of both environments to their fullest potential. As you become more familiar with each command and its functionality, you’ll find that the power of automation and scripting is at your fingertips.

Additional Resources
- For a deeper understanding, refer to the official PowerShell documentation provided by Microsoft.
- Explore additional literature and online courses that delve into CMD and PowerShell for advanced learning.

FAQs
What is the difference between CMD and PowerShell?
While CMD provides basic command-line functionality, PowerShell offers a comprehensive scripting environment powered by .NET, allowing for advanced automation and system management.
Can I run any PowerShell command from CMD?
Yes, most PowerShell commands can be executed from CMD. However, some cmdlets rely on specific PowerShell context or modules that may not be loaded in CMD.
Is it safe to change the Execution Policy?
Changing the execution policy can expose your system to risk, especially if you allow unsigned scripts to run. It is advisable to understand the implications and use caution when altering these settings.