@ECHO OFF if "%~1"=="_SO42546112_" ( shift ) else ( start "/?" cmd /D /K ""%~f0" "_SO42546112_"" exit )
To run the command line new CMD
with the window title /?
double click on the .bat
script.
To run the .bat
script header with /?
, use the above concept, for example. in the following way:
@ECHO OFF SETLOCAL EnableExtensions rem self wrapper - start if "%~1"=="_SO42546112_" ( shift ) else ( start "/?" cmd /D /C ""%~f0" "_SO42546112_" %*" exit /B rem โโ omit the `/B` switch to close calling `cmd` window ) rem self wrapper - end rem check whether the self wrapper works - start echo 1st "%~1" echo 2nd "%~2" echo 3rd "%~3" echo all %* pause rem check whether the self wrapper works - end rem original script continues here:
source share