I've just noticed a bizarre bug, which is new to me:
When you run a batch file in cmd.exe, the batch command line is displayed on the title bar.
And when the batch exits, the title bar changes back to the previous title. Ex: Administrator: Command Prompt
But I just found a case where the command line remains unchanged on the title bar after the batch exits!
And the next batch you run appears _after_ the one that remains.
If you run the faulty batch multiple times, the title bar message grows ever longer.
The key is to run a another batch as the second command after an &.
Ex:
t1.bat
Code: Select all
@echo off
setlocal
endlocal & t2.bat %*
Code: Select all
@echo This is %0 %*
Administrator: Command Prompt - t1 Hello batch world
then
Administrator: Command Prompt - t1 Hello batch world - t1 Hello batch world
etc...
Now if you change the last line in t1.bat to:
Code: Select all
endlocal & call t2.bat %* & exit /b
The endlocal is how I discovered the issue, but it's not the cause. If I change the line to a stupid:
Code: Select all
cd >NUL & t2.bat %*
Was this bug known already?
Any way to use and abuse it, like we like to do here?