显然可以设置包含cmd标准分隔符的标题,但是通过TITLE
命令看起来无法设置以分隔符开头的标题。
可以使用以下标题创建一个新的CMD实例:
start "==" cmd.exe
但对同一个实例不可能。
也可以使用.NET和Console.Title
属性,但是当从批处理文件中调用它时,只要编译的exe运行,tile就会持续:
@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);
(可能通过代码注入)
是否有Windows'本地'方式?
答案 0 :(得分:3)
使用Win7 x64,当换行符位于有问题的字符前面时,我可以生成它。
SELECT SUBSTR(value, 1, INSTR(value,'-')) FROM table;
在Win7中,当使用LF时,标题的高度或位置似乎没有差异。
使用
进行测试@echo off
setlocal EnableDelayedExpansion
set LF=^
title !LF!,bc
但是当前程序在标题中运行时显示,因此cmd /V:on
@for /L %n in (1 1 1111) do @(title !LF!=Hello& title +Hello)
命令本身会产生闪烁。
答案 1 :(得分:3)
我找到了另一种方式:
title ^A,string
通过在按住^A
- 键(0
)的同时输入1
ALT
来生成<pressALT><0><1><releaseALT>
。
您可以将其放入echo ^A>>batch.bat
的文件中,然后使用记事本将其移动到正确的位置(它没有显示在记事本中,就像空白一样;比空格宽,但不是宽广作为TAB)
答案 2 :(得分:2)
LF
是问题的答案,但也有一种解决方法。我想我已经检查了所有的ASCII字符,看起来FS and GS个字符没有显示在命令提示符的标题中(这里是FS
的例子):
@echo off
setlocal
::dbenham's 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
但这不是一个“完美”的解决方案,因为 AppActivate 或任务列表命令会检测到FS
和GS
字符(没有这样的问题)与LF
)。
也可以使用SOH
字符,但它显示为空格。
FS也可以用ctrl +]
制作GS with ctrl + \
使用ctrl + A
的SOH