Skip to main content

How to Run PowerShell Script on Windows Startup?

· One min read
Jagdish Kumawat
Founder @ Dewiride

This is useful when you want to run any automation created using PowerShell on Windows Startup. To run PowerShell script on startup.

Create a Windows Command Script (.cmd file) i.e. create a file and save it with .cmd extension.

Create a Windows Command Script

Write the below command in .cmd file:

script.cmd
powerShell path\to\powershell_script.ps1 >> “path\to\log_file.log”

Script.cmd file content

If you want to run the script in background. Add -windowstyle hidden after powershell.

script.cmd
powerShell -windowstyle hidden D:\scripts\script1.ps1 >> D:\logs\StartupLog.log

Script.cmd file content with hidden window

Place the file or its shortcut file at below path:

C:\Users\<user_name>\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup

Place the script in Startup folder

Restart the computer and you can track its execution in log file.

Stay Updated

Subscribe to our newsletter for the latest tutorials, tech insights, and developer news.

By subscribing, you agree to our privacy policy. Unsubscribe at any time.