<http://www.netikka.net/tsneti/info/tscmd132.htm>
Copyright © 2003-2010 by Prof. Timo Salmi  
Last modified Sun 25-Apr-2010 10:12:45

 
Assorted NT/2000/XP/.. CMD.EXE Script Tricks
From the html version of the tscmd.zip 1cmdfaq.txt file
To the Description and the Index
 

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=abcdefghijklmnopqrstuvwxyza
  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 ä

References/Comments: (If a Google message link fails try the links within the brackets.)
  The inventive method is due to Clay Calvert:
    Google Groups Feb 14 2006, 7:21 am [M]
 Also of interest:
    JSI Tip 9830