This page is edited from the 1cmdfaq.txt faq-file contained in
my tscmd.zip
command line interface (CLI) collection. That zipped file has much
additional material, including a number of detached .cmd script
files. It is recommended that you also get the zipped version as a
companion.
Please see "
The Description and
the Index page" for the conditions of usage and other such
information.
132} How to find out the next weekday given today's?
Or, as a native English speaker would put it
"
How to find out the next day of the week,
given that of today?"
@echo off & setlocal enableextensions
set Day=%~1
set week=
Sun Mon Tue Wed Thu Fri Sat
Sun
call set SubWeek=%%Week:*%day%=%%
Set NextDay=%SubWeek:~1,3%
echo After %Day% comes %NextDay%
endlocal & goto :EOF
The output might be e.g.
C:\_D\TEST>cmdfaq thu
After thu comes Fri
A similar task for the next character, with the Finnish alphabet
@echo off & setlocal enableextensions
set letter=%1
set alpha=
abcdefghijklmnopqrstuvwxyzåäö
a
call set beta=%%alpha:*%letter%=%%
set last=%beta:~,1%
echo After %letter% comes %last%
endlocal & goto :EOF
The output might be e.g.
C:\_D\TEST>cmdfaq Å
After Å comes ä