How to set a heading starting with a semicolon, semicolon or equal sign?

Obviously, you can set a header containing standard cmd separators, but with the TITLE command you cannot set a header starting with a separator.

You can create a new CMD instance with this name:

 start "==" cmd.exe 

but not possible for the same instance.

It is also possible with the .NET and Console.Title property, but when it is called from a batch file, the tile lasts until the compiled exe is executed:

 @if (@X)==(@Y) @end /* JScript comment @echo off setlocal for /f "tokens=* delims=" %%v in ('dir /b /s /a:-d /o:-n "%SystemRoot%\Microsoft.NET\Framework\*jsc.exe"') do ( set "jsc=%%v" ) if not defined jsc ( echo !!! Installation of .NET framework needed !!! pause exit /b 3 ) rem echo %jsc% ::if not exist "%~n0.exe" ( del /q /f %~n0.exe call "%jsc%" /nologo /out:"%~n0.exe" "%~dpsfnx0" ::) call %~n0.exe %* endlocal & exit /b %errorlevel% */ import System; var arguments:String[] = Environment.GetCommandLineArgs(); //Console.WriteLine(Console.Title); if (arguments.length>0){ Console.Title=arguments[1]; } //Console.WriteLine(Console.Title); 

(Perhaps this is possible when entering the code)

Is there a windows native way?

+4
source share
3 answers

With Win7 x64, I can create it when the translation string is before the problem characters.

 @echo off setlocal EnableDelayedExpansion set LF=^ title !LF!,bc 

In Win7 there is no difference in height or header position when using LF.

Tested with

 cmd /V:on @for /L %n in (1 1 1111) do @(title !LF!=Hello& title +Hello) 

But the current program is displayed at the time of its launch in the header, so the TITLE command itself causes a flicker.

+3
source

I found another way:

 title ^A,string 

where ^A is created by entering 0 1 while holding down the ALT key ( <pressALT><0><1><releaseALT> ).

You can get it to a file using echo ^A>>batch.bat , and then move it to the desired position using notepad (it does not appear in notepad as a space, wider than a space, but not as wide as TAB)

+3
source

LF is the answer to the question, but there is also a workaround. I think I checked all the ASCII characters and looked like the FS and GS characters do not appear in the command line header (here is an example with FS ):

 @echo off setlocal ::dbenham hexprint was used here ::http://www.dostips.com/forum/viewtopic.php?p=23888 ::Define a Linefeed variable set LF=^ ::above 2 blank lines are critical - do not remove. ::Create a FS variable call :hexprint "0x1C" FS title %FS%=;= exit /b :hexPrint string [rtnVar] for /f eol^=^%LF%%LF%^ delims^= %%A in ( 'forfiles /p "%~dp0." /m "%~nx0" /c "cmd /c echo(%~1"' ) do if "%~2" neq "" (set %~2=%%A) else echo(%%A exit /b 

But this is not an ideal solution, as the AppActivate or Tasklist command detects FS and GS characters (without such a problem with LF ). The SOH character may also be used, but it appears as a space.

FS can also be produced using ctrl +]

GS using Ctrl + \

SOH with Ctrl + A

+2
source

Source: https://habr.com/ru/post/1015394/


All Articles