hackoofr

Show Seconds in System Clock.bat

Dec 25th, 2022
150
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Batch 1.99 KB | Source Code | 0 0
  1. @echo off
  2. Title Show Or Hide Seconds In System Clock
  3. Color 9E & Mode 80,10 & SetLocal EnableDelayedExpansion
  4. Set "Key=HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced"
  5. ::--------------------------------------------------------------------------
  6. :GetInfo
  7. @REM Get Opened Folders with PowerShell code in a batch file
  8. Set PSCommand="@((New-Object -com shell.application).Windows()).Document.Folder | ForEach { $_.Self.Path }"
  9. REM  Populate the array with existent and opened folders
  10. SetLocal EnableDelayedExpansion
  11. Set /a Count=0
  12. for /f "delims=" %%a in ('Powershell -C %PSCommand%') do (
  13.     Set /a Count+=1
  14.     Set "Folder[!Count!]=%%a"
  15. )
  16. ::===========================================================================
  17. :menuLOOP
  18. ::===========================================================================
  19. echo(
  20. echo(
  21. echo(       ***************************** Menu ******************************
  22. echo(
  23. @for /f "tokens=2* delims=_ " %%A in ('"findstr /b /c:":menu_" "%~f0""') do (
  24. echo(                 %%A  %%B)
  25. echo(
  26. echo(       *****************************************************************
  27. echo( &Set /p Selection=Make a Selection or hit ENTER to quit: || Goto :EOF
  28. echo( & Call:menu_[%Selection%]
  29. GOTO:menuLOOP
  30. ::===========================================================================
  31. ::---------------------------------
  32. :menu_[1] Show Seconds In SystemClock
  33. reg Add "%Key%" /V ShowSecondsInSystemClock /T REG_DWORD /D 1 /F 1>NUL
  34. Call:Restart_Explorer
  35. @rem Restore all closed folders
  36. @for /L %%i in (1,1,%Count%) do Start /MAX Explorer "!Folder[%%i]!"
  37. Exit /B
  38. ::---------------------------------
  39. :menu_[2] Hide Seconds In SystemClock
  40. reg Add "%Key%" /V ShowSecondsInSystemClock /T REG_DWORD /D 0 /F 1>NUL
  41. Call:Restart_Explorer
  42. @rem Restore all closed folders
  43. @for /L %%i in (1,1,%Count%) do Start /MAX Explorer "!Folder[%%i]!"
  44. Exit /B
  45. ::---------------------------------
  46. :Restart_Explorer
  47. powershell -C "gps explorer | spps"
  48. Exit /B
  49. ::---------------------------------
Advertisement
Add Comment
Please, Sign In to add comment