I have this script, it opens the current date’s folder but it does not add it to quick…
- User
I have this script, it opens the current date’s folder but it does not add it to quick access folder. Also is it possible to remove older dates (with the same format). Here is the script : @echo off setlocal enabledelayedexpansion
REM Get the current year, month, and day from the DATE variable set “currentYear=!DATE:~10,4!” set “currentMonth=!DATE:~4,2!” set “currentDay=!DATE:~7,2!”
REM Map numeric month to its corresponding name set “monthName=” if %currentMonth% equ 01 set “monthName=JANUARY” if %currentMonth% equ 02 set “monthName=FEBRUARY” if %currentMonth% equ 03 set “monthName=MARCH” if %currentMonth% equ 04 set “monthName=APRIL” if %currentMonth% equ 05 set “monthName=MAY” if %currentMonth% equ 06 set “monthName=JUNE” if %currentMonth% equ 07 set “monthName=JULY” if %currentMonth% equ 08 set “monthName=AUGUST” if %currentMonth% equ 09 set “monthName=SEPTEMBER” if %currentMonth% equ 10 set “monthName=OCTOBER” if %currentMonth% equ 11 set “monthName=NOVEMBER” if %currentMonth% equ 12 set “monthName=DECEMBER”
REM Define the base folder path set “basePath=U:\01 NEWS\01 DAILY NEWS”
REM Create the full folder path by appending the current year, month, and day set “currentFolder=%currentDay%%currentMonth%%currentYear:~-2%” set “fullPath=%basePath%%currentYear%%currentMonth%%monthName%%currentFolder%“
REM Remove old folders from Quick Access with the same structure set “removeCommand=” for /d %%I in (”%basePath%%currentYear%%currentMonth%%monthName%***”) do ( if /i not “%%~nxI”==“%currentFolder%” ( set “removeCommand=!removeCommand!; Remove-ItemProperty -Path ‘HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Taskband’ -Name ‘%%~nxI’ -ErrorAction SilentlyContinue” ) )
if defined removeCommand ( powershell -Command “& { $removeCommand }” )
REM Open the folder using explorer explorer “%fullPath%”
REM Call the dynamic VBS script to pin the folder to Quick Access cscript //nologo “AddToQuickAccess.vbs” “%fullPath%”
endlocal
- Assistant