如何设置以逗号,分号或等号开头的标题? [英] How can I set a title that starts with comma, semicolon or equal sign?

查看:82
本文介绍了如何设置以逗号,分号或等号开头的标题?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

显然可以设置包含cmd标准定界符的标题,但是通过TITLE命令似乎无法设置以定界符开头的标题.

Obviously it is possible to set title that contains cmd's standard delimiters but through TITLE command looks impossible to set a title that starts with a delimiter.

可以使用这样的标题创建一个新的CMD实例:

It is possible to create a new instance of CMD with such title:

start "==" cmd.exe

但不适用于同一实例.

.NET和Console.Title属性也可以使用,但是当从批处理文件中调用时,只要编译的exe运行,平铺就会持续:

It is possible also with .NET and Console.Title property but when it's called from batch file the tile lasts as long as the compiled exe runs:

@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); 

(可能通过代码注入是可能的)

(Probably is possible through code injection)

是否有Windows本机"方式?

Is there a windows 'native' way?

推荐答案

使用Win7 x64,当换行符出现在有问题的字符前面时,我可以生成它.

With Win7 x64, I can produce it when a linefeed is in front of the problematic characters.

@echo off
setlocal EnableDelayedExpansion
set LF=^



title !LF!,bc

在Win7中,使用LF时标题的高度或位置似乎没有差异.

In Win7 there seems no difference in the height or position of the title when LF is used.

经过测试

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

但是在标题中显示了当前程序的运行时间,因此TITLE命令本身会产生闪烁.

But the current program is shown for the time it's running in the title, so the TITLE command itself produces a flicker.

这篇关于如何设置以逗号,分号或等号开头的标题?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆