0

I need some help creating a .bat script that starts a program and when done it restarts the computer.

cmd /c C:\"Program Files"\"Toolwiz Time Freeze"\ToolwizTimeFreeze.exe /usepass=password /freezealways

This is what is should do first. This works fine. This will enable the program to protect after every restart. That's why I need to add a restart. I was thinking of adding this

&& shutdown /r /f /0

Problem is that the command prompt keeps hanging. And the shutdown does not go through. Any ideas?

Saeed
  • 366
  • 3
  • 11

2 Answers2

1

The syntax that you should use for the shutdown command is:

shutdown -r -f -t 0

I think it might be your /0 that is throwing it off. The full syntax can be found here on TechNet.

SamErde
  • 3,409
  • 3
  • 24
  • 44
0

Why do you launch another instance of cmd? Simply use

C:\"Program Files"\"Toolwiz Time Freeze"\ToolwizTimeFreeze.exe /usepass=password /freezealways
shutdown /r /f /0

or, if shutdown should depend on previous command exit code:

C:\"Program Files"\"Toolwiz Time Freeze"\ToolwizTimeFreeze.exe /usepass=password /freezealways
if %errorlevel% EQU 0 (
    shutdown /r /f /0
) else (
    echo No success, an error occurred
    rem add next commands here (optional)
)
JosefZ
  • 1,564
  • 1
  • 10
  • 18
  • Yeah the cmd shouldn't have been there. I just pasted my command here. I will test out your suggestion. Thanks a lot for the effort – Saeed Mar 15 '15 at 21:40