設定 AutoRun 的預設行為 的登錄值 NoAutorun使用者HKCU\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer
- 原則 ID
- NoAutorun
- 適用範圍
- 電腦設定、使用者設定
- 支援的作業系統
- 至少需要 Windows Vista
- 來源
- Administrative Templates (.admx) for Windows 11 2026 Update (26H2) (版本 1.0)
- 類別
- Windows 元件 › 自動播放原則
登錄
NoAutorun
REG_DWORD使用者電腦…\Software\Microsoft\Windows\CurrentVersion\Policies\ExplorerHKCU\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer 目前的機碼
HKLM\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer
HKLM\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer
- 啟用時的值
- 取決於選項值
- 元素
- 預設 AutoRun 行為
| 項目 | 儲存的值 |
|---|---|
| 不執行任何 AutoRun 命令 | 1 |
| 自動執行 AutoRun 命令 | 2 |
以 .reg · CMD · PowerShell 套用
使用者各帳戶的設定
.reg
Windows Registry Editor Version 5.00 [HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer] ; 選項 (只使用其中一個) ; 不執行任何 AutoRun 命令 "NoAutorun"=dword:00000001 ; 自動執行 AutoRun 命令 "NoAutorun"=dword:00000002
CMD
:: 選項 (只使用其中一個) :: 不執行任何 AutoRun 命令 reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer" /v "NoAutorun" /t REG_DWORD /d 1 /f :: 自動執行 AutoRun 命令 reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer" /v "NoAutorun" /t REG_DWORD /d 2 /f
PowerShell
# 共通: 建立機碼 New-Item -Path 'HKCU:\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer' -Force | Out-Null # 選項 (只使用其中一個) # 不執行任何 AutoRun 命令 New-ItemProperty -Path 'HKCU:\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer' -Name 'NoAutorun' -PropertyType DWord -Value 1 -Force | Out-Null # 自動執行 AutoRun 命令 New-ItemProperty -Path 'HKCU:\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer' -Name 'NoAutorun' -PropertyType DWord -Value 2 -Force | Out-Null
電腦整部電腦的設定
.reg
Windows Registry Editor Version 5.00 [HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer] ; 選項 (只使用其中一個) ; 不執行任何 AutoRun 命令 "NoAutorun"=dword:00000001 ; 自動執行 AutoRun 命令 "NoAutorun"=dword:00000002
CMD
:: 選項 (只使用其中一個) :: 不執行任何 AutoRun 命令 reg add "HKLM\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer" /v "NoAutorun" /t REG_DWORD /d 1 /f :: 自動執行 AutoRun 命令 reg add "HKLM\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer" /v "NoAutorun" /t REG_DWORD /d 2 /f
PowerShell
# 共通: 建立機碼 New-Item -Path 'HKLM:\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer' -Force | Out-Null # 選項 (只使用其中一個) # 不執行任何 AutoRun 命令 New-ItemProperty -Path 'HKLM:\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer' -Name 'NoAutorun' -PropertyType DWord -Value 1 -Force | Out-Null # 自動執行 AutoRun 命令 New-ItemProperty -Path 'HKLM:\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer' -Name 'NoAutorun' -PropertyType DWord -Value 2 -Force | Out-Null