2

I know we can reboot windows with shutdown /r /t 0 command, but is there any way to restart just running reboot on Run?

1
  • Create the reboot.bat file with proper command(s) and place it into any folder which presents in PATH environment variable.
    – Akina
    Sep 13, 2018 at 9:14

3 Answers 3

2

You could create a .bat script containing the command(shutdown -r -t 0), save it as reboot.bat and then place it somewhere suitable on your system. If the location is not already in PATH, add it to PATH using the command below. This will work when using it in CMD. For use with RUN, see grawity's comment below.

set PATH = %PATH%;C:/Directory/Where/You/Saved
3
  • You can skip the latter part and use your "user profile" folder C:\Users\lcsncm – it works because it's the "current folder" as far as Explorer is concerned, so it gets checked even before %PATH%. Sep 13, 2018 at 9:20
  • However, I don't think your example command will do much good. Environment variables of a child process (CMD) don't automatically propagate to the parent process (Explorer). To actually update %PATH% such that it would work with Run, you would need to set it in the registry to be applied at logon time. Sep 13, 2018 at 9:23
  • Yes, I can see the issue. I will edit my answer accordingly.
    – ddybing
    Sep 13, 2018 at 9:27
0

Actually, I've created a bat file with following lines @echo off shutdown /r /t 0 And placed in %windir%/system32/reboot.bat didn't add the path. I've tested with Run and command prompt, working fine Thanks for your help

0
    echo shutdown /r /t 0 > reboot.cmd
reboot

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .