How to Run PowerShell Script on Windows Startup?
How to Run PowerShell Script on Windows Startup?
![](https://i0.wp.com/jd-bots.com/wp-content/uploads/2021/05/powershell.png?fit=1400%2C1400&ssl=1)
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.
![](https://i0.wp.com/jd-bots.com/wp-content/uploads/2021/05/image-109.png?resize=626%2C96&ssl=1)
Write the below command in .cmd file.
powerShell path\to\powershell_script.ps1 >> “path\to\log_file.log”
![](https://i0.wp.com/jd-bots.com/wp-content/uploads/2021/05/image-110.png?resize=516%2C120&ssl=1)
If you want to run the script in background. Add -windowstyle hidden
after powershell.
![](https://i0.wp.com/jd-bots.com/wp-content/uploads/2021/05/image-112.png?resize=551%2C73&ssl=1)
Place the file or its shortcut file at below path.
C:\Users\<user_name>\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup
![](https://i0.wp.com/jd-bots.com/wp-content/uploads/2021/05/image-111.png?resize=596%2C126&ssl=1)
Restart the computer and you can track its execution in log file.
Comments
Post a Comment