View Single Post
  #9  
Old September 19th 18, 11:34 PM posted to alt.msdos.batch,alt.windows7.general
VanguardLH[_2_]
external usenet poster
 
Posts: 10,881
Default how to get the title into task manger 'window'?

Herbert Kleebauer wrote:

pyotr filipivich wrote:

I run batch files. (well 'duh') Sometimes I'll have two or more
running, but when I look at the task bar, all I see of the "title"
is "Adminis..."

IF I hover over the mouse, up pops the popup with the full title:
e.G., "Administrator: ZZ Home Agent Bat".

Is there a way to eliminate, remove, not display the "administrator"
part, or is that a Feature? It occurs to me,that if I could rename
"administrator" to something shorter (E.G., Adm, Me, ...) that would
serve as a "solution" of sorts.


Use the title command within your batch to set the title to any
string you like.


Learned something new. Thanks.

https://en.wikipedia.org/wiki/Title_(command)

Note that this (or using "start "title" parms") will not get rid of
the "Administrator: " prefix in the shell's console window. That is
shown because the OP is loading the command shell (cmd.exe) with
elevated [admin] privs by running the .bat file within an already opened
command shell with elevated privs, using a shortcut configured to run
elevated, or using runas (or some other means I'm not remembering right
now). Without elevated privileges, the console window would just be the
name of the batch file or the title specified in a 'start' or 'title'
command.

That's a feature of the command interpreter (cmd.exe). To modify that
shell program, you could try the suggestion at:

https://serverfault.com/questions/35...le/35587#35587

From what I saw using HxD (hex editor), cmd.exe.mui uses two bytes per
character for Unicode encoding, so "Administrator: 0%" will look like:

A.d.m.i.n.i.s.t.r.a.t.o.r.:. .%.0
(where each dot is 00)

or, in hex:

41 00 64 00 6D 00 69 00 6E 00 69 00 73 00 74 00 72 00 61 00 74 00 6F 00
72 00 3A 00 20 00 25 00 30 00

I'm not sure you want to delete the 2-byte chars for "Administrator: "
which results in a shorter string. That might fire some alert about a
modified system file. Instead I'd first try nullifying that substring,
so it looks like:

00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 25 00 30 00

If that didn't work, then move the "%0" to the front of the string and
nullifying out the rest of the string, as in:

25 00 30 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00

The author says there should be 2 space chars before the "0%", so maybe
you have to use:

00 00 25 00 30 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00

Or use a different shell program with different behavior.

Or load the command shell (cmd.exe) as a normal user (not elevated) if
it doesn't run any program that needs admin privs. As an option
mentioned in the above forum thread, if the batch file needs admin privs
but can run under a different account (i.e., it does not need to only
run under your Windows account), you could create a new account called,
say, "A", that was in the Administrators security group (i.e., an admin
account) and use "runas /user:a parms" which would have "A: batfile"
as the shell's window title.

Or copy cmd.exe from a Windows XP host to your Windows 7 host to some
holding folder (do not copy atop the cmd.exe for Windows 7) and call
that cmd.exe to load the batch file. I've read where that old shell
program did not add "Adminstrator: " as prefix to the console window
when that shell was loaded with admin privs.

The "Administrator: " prefix in the title is a feature in cmd.exe to
alert the user that they are running the command shell with elevated
privileges.
Ads