More info about TITLE command

Microsoft Windows
Post Reply
User avatar
MigrationUser
Posts: 336
Joined: 2021-Jul-12, 1:37 pm
Contact:

More info about TITLE command

Post by MigrationUser »

18 Dec 2012 00:03
carlos

Hello. I check that the max length of the TITLE command is 259 characters. More characters than it causes a print of error message.

Test code:

Code: Select all

@TITLE AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAZ
Last edited by carlos (18 Dec 2012 00:03)

----------------------------

#2 18 Dec 2012 10:14
bluesxman


I make it 258 (on WinXP) using the following code:

Code: Select all

@echo off

setlocal enabledelayedexpansion
set "title="
set "count=0"
for /l %%a in (0,1,26) do (
for %%b in (1 2 3 4 5 6 7 8 9 .) do (
title !title! || (set count & set title & pause & exit)
set "title=!title!%%b"
set /a count+=1
)
)
Either way, it's a slightly odd number as I'd have expected a 2ⁿ or (2ⁿ)-1 value.

cmd | *sh | ruby | chef

----------------------------

#3 18 Dec 2012 12:02
AiroNG

243 is the limit on my windows 7 machine, while on my virtual xp i got the same result as bluesxman.

It's not that i would ever need the title to have an awful amount of characters in it, but does anyone know the reason for the limitation?

I don't suffer from insanity, I enjoy every minute of it.

----------------------------

#4 18 Dec 2012 13:28
npocmaka


this made me wonder if there's a limitation for PROMPT command.On my win7 machine it seems to be 400 symbols- but $G,$P,$T ... are taken as a single symbols.

Last edited by npocmaka (18 Dec 2012 13:47)

----------------------------

#5 18 Dec 2012 15:57
dbenham
AiroNG wrote:

243 is the limit on my windows 7 machine, while on my virtual xp i got the same result as bluesxman.

It's not that i would ever need the title to have an awful amount of characters in it, but does anyone know the reason for the limitation?
Haven't a clue why. On my Windows 7 machine the limit is 259, as reported by Carlos.

So there are two related mysteries - why the odd limit? and why does the limit vary, even within the same OS?
npocmaka wrote:

this made me wonder if there's a limitation for PROMPT command.On my win7 machine it seems to be 400 symbols- but $G,$P,$T ... are taken as a single symbols.
Again, haven't a clue about the limit. But it makes sense $G, $P, $T are treated as single bytes, since that is what they represent. I suspect that $H is 3 bytes because it represents <backspace><space><backspace>.

Dave Benham

----------------------------

#6 18 Dec 2012 16:21
RG


Depends on what else you have in the title bar. For example:
Using bluesxman's code On my Vista, Windows 7, Windows 8, 2008 Server, and 2012 Server machines I get a count of 259.
If I 'Run as administrator' on the same machines I get a count of 243.
This is because "Administrator: " appears in the title bar. So obviously this would vary depending on language.
On XP SP3 I get 258.

Last edited by RG (18 Dec 2012 20:27)

Windows Shell Scripting and InstallShield
Post Reply