Execute

Commands

C:\path\to\yourscript.bat

Executes a batch script located at the specified path using CMD.

powershell -File C:\path\to\yourscript.ps1

Executes a PowerShell script (.ps1 file) from CMD.

start C:\path\to\yourprogram.exe

CMD to run an executable program.

& "C:\path\to\yourscript.ps1"

Executes a PowerShell script from within a PowerShell session.

& "C:\path\to\yourprogram.exe"

Directly executes an executable program from a PowerShell session.

.\yourscript.ps1

Runs a PowerShell script located in the current directory from a PowerShell session.

Invoke-Expression -Command "C:\path\to\yourscript.ps1"

Executes a PowerShell script using Invoke-Expressionin PowerShell.

Start-Process -FilePath "C:\path\to\yourprogram.exe"

Starts an executable program from PowerShell.

cmd /c C:\path\to\yourscript.bat

Executes a batch script from within a PowerShell session using CMD.

Starts a PowerShell script using Start-Process in PowerShell.

Start-Process -FilePath "powershell.exe" -ArgumentList "-File C:\path\to\yourscript.ps1"

Command Prompt (CMD)

Execute a script:

script_name.bat for batch files (.bat)

script_name.cmd for command files (.cmd)

script_name.vbs for Visual Basic scripts (.vbs)

script_name.ps1 for PowerShell scripts (.ps1), requires enabling script execution first

Execute an executable: executable_name.exe

PowerShell

Execute a script:

.\script_name.ps1
& 'C:\path\to\script.ps1'

Execute an executable:

Start-Process executable_name.exe

Last updated

Was this helpful?