Perhaps this does not work, because the script line of the Windows Shutdown Windows pop-up window in which you specified the location of the .bat file tells the computer to search for the location of the PowerShell file (.ps1) and not the .bat file, hence the error. Enter the same file location on the Scripts tab.
Alternatively, I can suggest creating a shortcut for the .bat file (for example, on your desktop), and when you want to shut down your computer (and start the .bat file), click on the shortcut that you created. After that, edit the .bat file and add this line of code to the end or where necessary:
c:\windows\system32\shutdown -s -f -t 00
What does it mean?
- Starts the shutdown process.
- Displays a warning
- Makes all running processes stop
- Running immediately
source share