Executing a batch script on Windows shutdown

前端 未结 6 614
旧巷少年郎
旧巷少年郎 2020-12-08 06:55

Is there any way, in Windows 7 Professional, to run a batch script (e.g., a .BAT file) when the user clicks on \"shutdown\" (not a batch file scheduled to shut

6条回答
  •  [愿得一人]
    2020-12-08 07:36

    For the above code to function; you need to make sure the following directories exist (mine didn't). Just add the following to a bat and run it:

    mkdir C:\Windows\System32\GroupPolicy\Machine\Scripts\Startup
    mkdir C:\Windows\System32\GroupPolicy\Machine\Scripts\Shutdown
    mkdir C:\Windows\System32\GroupPolicy\User\Scripts\Startup
    mkdir C:\Windows\System32\GroupPolicy\User\Scripts\Shutdown
    

    It's just that GP needs those directories to exist for:

    Group Policy\Local Computer Policy\Windows Settings\Scripts (Startup/Shutdown)
    

    to function properly.

提交回复
热议问题