Regsvr32.exe 用於註冊/解除註冊可自我註冊的 OLE 控件(DLL、OCX)。完整指令語法與錯誤代碼對照:
Regsvr32 [/n] [/i[:cmdline]] dllname
/u - 解除註冊伺服器
/i - 呼叫 DllInstall(可帶選用 cmdline),搭配 /u 呼叫解除安裝
/n - 不呼叫 DllRegisterServer,需搭配 /i 使用
| 錯誤訊息 | 原因 |
|---|---|
| Unrecognized flag | 參數/開關組合無效 |
| No DLL name specified | 未指定 .dll 檔名 |
| DllRegisterServer/DllUnregisterServer entry point not found | 非 .dll/.ocx 檔,或未匯出註冊函數 |
| Not an executable file | 非 .exe/.dll/.ocx 執行檔(如 .bat) |
| Dll loaded but entry point not found | 記憶體中有損壞版本,建議重開機或重新提取原始檔 |
| Not self-registerable / corrupted version in memory | 檔案不支援自我註冊(如 icwdial.dll)或記憶體損壞 |
| OleInitialize/OleUninitialize failed | COM 程式庫初始化/反初始化失敗 |
手動註冊 Sample.ocx: regsvr32.exe sample.ocx
解除註冊: regsvr32 /u sample.ocx
進階:Win32 錯誤代碼完整表請參考 MSDNWin32 Error Codes文件。若在 Windows NT 環境需終止殘留進程,可使用 Resource Kit 的Kill或Pview工具。