Windows Server 2012 R2 - 製作將在啟動時執行記事本的批次文件

Windows Server 2012 R2 - 製作將在啟動時執行記事本的批次文件

我有以下問題:

在Windows Server 2012 R2中,如何製作將在啟動時執行記事本的批次檔?

提前致謝。

答案1

若要從命令提示字元或批次檔組態啟動程序,可以在下列登錄路徑中新增登錄機碼設定。登錄路徑是:

  • 對於所有使用者:HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Run
  • 對於目前使用者:HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Run

使用reg add指令新增該註冊表。可執行檔(此處為Notepad.exe)的路徑是:C:\Windows\System32\Notepad.exe。設定此啟動對於所有用戶HKCUHKLM。替換C:\為電腦中的系統磁碟機代號。

  • 命令是:

    reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\Run" /V "Notepad" /D "C:\Windows\System32\Notepad.exe" /F
    
  • 若要恢復/撤銷此啟動程序,請使用下列命令刪除登錄機碼:

    reg delete  "HKCU\Software\Microsoft\Windows\CurrentVersion\Run" /V "Notepad" /F
    

延伸閱讀:

相關內容