Rob van der Woude's Scripting Pages
Powered by GeSHi

Source code for noautorun.bat

(view source code of noautorun.bat as plain text)

  1. @ECHO OFF
  2. IF NOT "%OS%"=="Windows_NT" GOTO Syntax
  3. IF /I "%~1"=="/Q" GOTO Run
  4.  
  5. :Syntax
  6. ECHO NoAutoRun.bat,  Version 1.00 for Windows XP
  7. ECHO Completely disable Windows' AutoRun feature
  8. ECHO.
  9. IF NOT "%OS%"=="Windows_NT" ECHO Usage:  %0  [ /Q ]
  10. IF     "%OS%"=="Windows_NT" ECHO Usage:  %~ns0  [ /Q ]
  11. ECHO.
  12. ECHO Where:  /Q  will suppress screen output and the prompt for confirmation
  13. ECHO.
  14. ECHO Based on an article by Scott Dunn
  15. ECHO http://windowssecrets.com/comp/071108
  16. ECHO.
  17. ECHO Written by Rob van der Woude
  18. ECHO http://www.robvanderwoude.com
  19.  
  20. IF NOT "%OS%"=="Windows_NT" GOTO End
  21. IF NOT "%~1"=="" IF /I NOT "%~1"=="/Q" GOTO End
  22.  
  23. ECHO.
  24. SET /P Answer=Are you sure you want to disable Windows' AutoRun? [yN] 
  25. ECHO.
  26. IF /I NOT "%Answer%"=="Y" (
  27. 	ECHO Script aborted by user request.
  28. 	ECHO The AutoRun feature was left unchanged.
  29. 	GOTO End
  30. )
  31.  
  32. :Run
  33. > "%Temp%.\NoAutoRun.reg" ECHO REGEDIT4
  34. >>"%Temp%.\NoAutoRun.reg" ECHO.
  35. >>"%Temp%.\NoAutoRun.reg" ECHO [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\IniFileMapping\Autorun.inf]
  36. >>"%Temp%.\NoAutoRun.reg" ECHO @="@SYS:DoesNotExist"
  37. >>"%Temp%.\NoAutoRun.reg" ECHO.
  38. START /WAIT REGEDIT.EXE /S "%Temp%.\NoAutoRun.reg"
  39. DEL "%Temp%.\NoAutoRun.reg"
  40.  
  41. IF /I NOT "%~1"=="/Q" ECHO Windows' AutoRun feature is now disabled on this computer.
  42.  
  43. :End
  44.  

page last modified: 2024-04-16; loaded in 0.0059 seconds