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

powershell Start-Process exit code -1073741502 when used with Credential from a windows service environment -

twig - Using Twigbridge in a Laravel 5.1 Package -

c# - LINQ join Entities from HashSet's, Join vs Dictionary vs HashSet performance -