Batch files to a different location on a daily basis -


trying write batch file ( windows environment ) take same txt file , copy location on daily basis, can manage, i'm struggling with, how copy different location each day ie:- mon/tue/wed/thur/fri/sat/sun possible ?

next code snippet help:

@echo off setlocal enableextensions  set "filename=the same txt file.txt" set "daynames=sunmontuewedthufrisat"  rem current matching day of current week (0-6, sunday being 0): multiplied 3 /f %%g in ('   wmic path win32_localtime dayofweek /value^|findstr "="   ') /f %%g in ("%%g") set /a "%%g*3"  rem day name (three-chars abbreviation) setlocal enabledelayedexpansion   set "dayofweekstr=!daynames:~%dayofweek%,3!" endlocal&set "dayofweekstr=%dayofweekstr%"  rem day name (three-chars abbreviation) - approach call set "dayofweektrs=%%daynames:~%dayofweek%,3%%"  rem next 2 commands merely echoed debugging purposes echo mkdir %dayofweekstr% 2>nul echo copy /b "%filename%" "%dayofweekstr%\%filename%"   rem next 2 lines debugging purposes echo( set dayofweek 

output:

==>so\30950430.bat mkdir sat copy /b "the same txt file.txt" "sat\the same txt file.txt"  dayofweek=18 dayofweekstr=sat dayofweektrs=sat  ==> 

Comments

Popular posts from this blog

timeout - Handshake_timeout on RabbitMQ using python and pika from remote vm -

gcc - MinGW's ld cannot perform PE operations on non PE output file -

c# - Search and Add Comment with OpenXML for Word -