Occasionally, I will need to use MS-DOS in my role at work. MS-DOS is one of the scripting languages to use while using Microsoft Windows operating system.
One of the problems with MS-DOS is that it is case-insensitive. MS-DOS does not distinguish the difference between upper case or lower case when using it. While this may not cause problems most circumstances while using Windows, it may potentially cause problems when interacting with other systems or programs.
I have used the following snippet of code to convert the %computername% variable, which was set as upper case to lower case. The result will be stored as %mycomputername%
dir /b/l %computername%>lower.tmp
set /p mycomputername=<lower.tmp
This snippet works by creating an empty file based on the variable that is in upper case. Then a directory listing is made, with the appropriate flags to list the output in lower case, and the output of this is stored in a file called lower.tmp. Then the contents of that file is read into the new variable. Finally the two temporary files are deleted.
I would have thought it would have been easier than that.