To run a PowerShell script from cmd, type powershell with -File and the script path, then any parameters:
powershell -NoProfile -ExecutionPolicy Bypass -File C:\Scripts\Send-Report.ps1 -City "San Antonio" -Days 30
Swap powershell for pwsh to use PowerShell 7. I ran every command below in a real Command Prompt window, and the two versions don’t always agree on paths, switches and exit codes.
Run a PowerShell script from cmd, step by step
Our test script is Send-Report.ps1. It prints the values it received and exits with code 3 when the city is Nowhere:
param(
[string]$City = 'Austin',
[int]$Days = 7,
[string[]]$Recipients = @('ops@contoso.com'),
[switch]$Detailed
)
"City: $City | Days: $Days | Recipients: $($Recipients.Count) | Detailed: $Detailed"
if ($City -eq 'Nowhere') { exit 3 }
The param() block at the top declares the parameters, the same way you pass variables to a PowerShell script from inside PowerShell.
- Press Windows + R, type
cmdand press Enter to open Command Prompt. - Move to the script’s folder with cd, for example
cd /d C:\Scripts. You can skip this if you type the full path. - Type
powershell -File, the script path and the parameters, then press Enter. - Read the output. The window stays in cmd, so you can run the next command right away.
Here are the three commands I typed in the Scripts folder. The first uses the defaults, the other two pass values:
powershell -NoProfile -ExecutionPolicy Bypass -File .\Send-Report.ps1
powershell -NoProfile -ExecutionPolicy Bypass -File .\Send-Report.ps1 -City "San Antonio" -Days 30
pwsh -NoProfile -ExecutionPolicy Bypass -File .\Send-Report.ps1 -City "San Antonio" -Days 30
Output:
City: Austin | Days: 7 | Recipients: 1 | Detailed: False
City: San Antonio | Days: 30 | Recipients: 1 | Detailed: False
City: San Antonio | Days: 30 | Recipients: 1 | Detailed: False

Put double quotes around values with spaces, like “San Antonio”. cmd doesn’t treat single quotes as quotes, so ‘San Antonio’ would arrive as two words.
Start a PowerShell session from cmd instead
If you’d rather work inside PowerShell, type powershell (or pwsh) and press Enter. The prompt changes to PS, and exit takes you back to cmd.