Rob van der Woude's Scripting Pages
Powered by GeSHi

Source code for ddlu.bat

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

  1. @ECHO OFF
  2. ECHO.
  3. ECHO DDLU.bat,  Version 1.00 for Windows 95/98/NT 4/2000
  4. ECHO Don't Display Last Username
  5. ECHO Clears the last user name from the login box by adding the following
  6. ECHO registry entry:
  7. ECHO.
  8.  
  9. IF NOT "%1"=="" GOTO Syntax
  10. VER | FIND /I "Windows" >NUL
  11. IF ERRORLEVEL 1 GOTO Syntax
  12.  
  13. :: Create temporary .REG file
  14. > %TEMP%.\DDLU.REG ECHO REGEDIT4
  15. >>%TEMP%.\DDLU.REG ECHO.
  16. IF "%OS%"=="Windows_NT" GOTO WinNT
  17. ECHO.%COMSPEC% | FIND /I "COMMAND.COM" >NUL
  18. IF ERRORLEVEL 1 GOTO Syntax
  19.  
  20. ::Win9x
  21. >>%TEMP%.\DDLU.REG ECHO [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Winlogon]
  22. ECHO   [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Winlogon]
  23. GOTO AddVal
  24.  
  25. :WinNT
  26. ECHO   [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon]
  27. >>%TEMP%.\DDLU.REG ECHO [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon]
  28.  
  29. :AddVal
  30. >>%TEMP%.\DDLU.REG ECHO "DontDisplayLastUserName"="1"
  31. >>%TEMP%.\DDLU.REG ECHO.
  32.  
  33. :: Ask for confirmation
  34. ECHO   DontDisplayLastUserName=1
  35. ECHO.
  36. ECHO Disclaimer:  Modifying the registry can cause serious problems that can
  37. ECHO              only be "solved" by reinstalling your operating system.
  38. ECHO              Use this batch file at your own risk.
  39. ECHO.
  40. ECHO Press any key to proceed, or Ctrl+C to abort . . .
  41. PAUSE > NUL
  42.  
  43. :: Add registry key using temporary file
  44. REGEDIT /S %TEMP%.\DDLU.REG
  45.  
  46. :: Remove temporary file
  47. DEL %TEMP%.\DDLU.REG
  48.  
  49. :: Done
  50. GOTO End
  51.  
  52. :Syntax
  53. ECHO   [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon]
  54. ECHO   DontDisplayLastUserName=1
  55. ECHO.
  56. ECHO Usage:  DDLU
  57. ECHO.
  58. ECHO Written by Rob van der Woude
  59. ECHO http://www.robvanderwoude.com
  60. ECHO.
  61. ECHO Disclaimer:  Modifying the registry can cause serious problems that can
  62. ECHO              only be "solved" by reinstalling your operating system.
  63. ECHO              Use this batch file at your own risk.
  64.  
  65. :End
  66.  

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