Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @echo off
- Title Show Or Hide Seconds In System Clock
- Color 9E & Mode 80,10 & SetLocal EnableDelayedExpansion
- Set "Key=HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced"
- ::--------------------------------------------------------------------------
- :GetInfo
- @REM Get Opened Folders with PowerShell code in a batch file
- Set PSCommand="@((New-Object -com shell.application).Windows()).Document.Folder | ForEach { $_.Self.Path }"
- REM Populate the array with existent and opened folders
- SetLocal EnableDelayedExpansion
- Set /a Count=0
- for /f "delims=" %%a in ('Powershell -C %PSCommand%') do (
- Set /a Count+=1
- Set "Folder[!Count!]=%%a"
- )
- ::===========================================================================
- :menuLOOP
- ::===========================================================================
- echo(
- echo(
- echo( ***************************** Menu ******************************
- echo(
- @for /f "tokens=2* delims=_ " %%A in ('"findstr /b /c:":menu_" "%~f0""') do (
- echo( %%A %%B)
- echo(
- echo( *****************************************************************
- echo( &Set /p Selection=Make a Selection or hit ENTER to quit: || Goto :EOF
- echo( & Call:menu_[%Selection%]
- GOTO:menuLOOP
- ::===========================================================================
- ::---------------------------------
- :menu_[1] Show Seconds In SystemClock
- reg Add "%Key%" /V ShowSecondsInSystemClock /T REG_DWORD /D 1 /F 1>NUL
- Call:Restart_Explorer
- @rem Restore all closed folders
- @for /L %%i in (1,1,%Count%) do Start /MAX Explorer "!Folder[%%i]!"
- Exit /B
- ::---------------------------------
- :menu_[2] Hide Seconds In SystemClock
- reg Add "%Key%" /V ShowSecondsInSystemClock /T REG_DWORD /D 0 /F 1>NUL
- Call:Restart_Explorer
- @rem Restore all closed folders
- @for /L %%i in (1,1,%Count%) do Start /MAX Explorer "!Folder[%%i]!"
- Exit /B
- ::---------------------------------
- :Restart_Explorer
- powershell -C "gps explorer | spps"
- Exit /B
- ::---------------------------------
Advertisement
Add Comment
Please, Sign In to add comment