Code: Select all
rem @echo off
if "%1" == "" goto error
if "%1" == "sec" goto sec
if "%1" == "pro" goto pro
if "%1" == "nl" goto nl
if "%1" == "nl2" goto nl2
goto error
:sec
rem Add section title
if "%2" == "" goto error
echo ======= > log.txt
echo =%2= >> log.txt
echo ======= >> log.txt
echo. >> log.txt
echo. >> log.txt
goto end
:pro
rem Add program title
if "%2" == "" goto error
echo ==%2== >> log.txt
echo. >> log.txt
goto end
:nl
rem New Line
echo. >> log.txt
goto end
:nl2
rem New Line x2
echo. >> log.txt
echo. >> log.txt
goto end
:error
echo. >> log.txt
echo bad log.cmd usage >> log.txt
:end
It's fairly simple - I use "call log sec Tools" to add the following into log.txt:
Code: Select all
=======
=Tools=
=======
In Notepad/Notepad_++ (which I use to view the log files), the "=" matches up with each letter, so it makes a nice block of text. But the section names aren't always 5 characters long, and I'd like to use it also for the individual program names (e.g. "BootZilla").
So, basically, I need to figure out how long %2 is, then print %2+2 equal signs to a text file (or save that amount of equal signs to a variable). Any ideas?