A Windows XP help forum. PCbanter

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » PCbanter forum » Microsoft Windows 7 » Windows 7 Forum
Site Map Home Register Authors List Search Today's Posts Mark Forums Read Web Partners

how to get the title into task manger 'window'?



 
 
Thread Tools Rate Thread Display Modes
  #1  
Old September 19th 18, 04:21 PM posted to alt.msdos.batch,alt.windows7.general
pyotr filipivich
external usenet poster
 
Posts: 752
Default how to get the title into task manger 'window'?


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.

tschus
pyotr



--
APL is a mistake, carried through to perfection. It is the language of the
future for the programming techniques of the past: it creates a new generation
of coding bums.
-- Edsger W. Dijkstra, SIGPLAN Notices, Volume 17, Number 5
  #2  
Old September 19th 18, 05:36 PM posted to alt.msdos.batch,alt.windows7.general
Herbert Kleebauer
external usenet poster
 
Posts: 27
Default how to get the title into task manger 'window'?

On 19.09.2018 17:21, 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.
  #3  
Old September 19th 18, 07:23 PM posted to alt.msdos.batch,alt.windows7.general
Kerr-Mudd,John
external usenet poster
 
Posts: 19
Default how to get the title into task manger 'window'?

On Wed, 19 Sep 2018 16:36:54 GMT, Herbert Kleebauer
wrote:

On 19.09.2018 17:21, 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.


title "Yaar!"

(It be talk like a pirate day. HTH)


--
Bah, and indeed, Humbug.
  #4  
Old September 19th 18, 11:09 PM posted to alt.msdos.batch,alt.windows7.general
pyotr filipivich
external usenet poster
 
Posts: 752
Default how to get the title into task manger 'window'?

Herbert Kleebauer on Wed, 19 Sep 2018 18:36:54 +0200
typed in alt.windows7.general the following:
On 19.09.2018 17:21, 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.


I do.
setting
Title ZZ Home Agent Bat
results in the window title
Administrator: ZZ Home Agent Bat

how do I get "Administrator" to a) go away,
b) be short enough I can see which "window title" on the task bar
is which actual window?

--
pyotr filipivich
Next month's Panel: Graft - Boon or blessing?
  #5  
Old September 20th 18, 08:58 PM posted to alt.msdos.batch,alt.windows7.general
Herbert Kleebauer
external usenet poster
 
Posts: 27
Default how to get the title into task manger 'window'?

On 20.09.2018 00:09, pyotr filipivich wrote:

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


I do.
setting
Title ZZ Home Agent Bat
results in the window title
Administrator: ZZ Home Agent Bat

how do I get "Administrator" to a) go away,
b) be short enough I can see which "window title" on the task bar
is which actual window?


Just looked up the Windows documentation. You can use SetWindowTextA
from User32.dll to change the title.

https://docs.microsoft.com/en-us/win...setwindowtexta

As long as the batch is running, the title is changed. When
the batch has finished, then the title is reset by CMD to the
original text. Here an example:

:::::::::::::::::::::::::::::::::::::::::::::::::: ::::::::::::::
:::::::::::::::::::::::::::::::::::::::::::::::::: ::::::::::::::
:::::::::::::::::::::::::::::::::::::::::::::::::: ::::::::::::::

@echo off
certutil -f -decode %~f0 settitle.exenul

settitle.exe ZZ Home Agent Bat
pause

del settitle.exe
goto :eof

-----BEGIN CERTIFICATE-----
TVpgAQEAAAAEAAAA//8AAGABAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAoAAAAA4fug4AtAnNIbgBTM0hTmljZSB0by BtZWV0IHNvbWVi
b2R5IHdobyBpcyBzdGlsbCB1c2luZyBET1MsDQpidXQgdGhpcy Bwcm9ncmFtIHJl
cXVpcmVzIFdpbjMyLg0KJFBFAABMAQEAUHmlNgAAAAAAAAAA4A APAQsBBQwAAgAA
AAAAAAAAAADMEAAAABAAAAAgAAAAAEAAABAAAAACAAAFAAAAAA AAAAUAAAAAAAAA
ACAAAAACAAAAAAAAAwAAAAAAEAAAEAAAAAAQAAAQAAAAAAAAEA AAAAAAAAAAAAAA
GBAAADwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAQAAAYAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAALnRleHQAAAACAQAAAB AAAAACAAAAAgAA
AAAAAAAAAAAAAAAAIAAA4AAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABoEAAAAA AAAJgQAACqEAAA
vhAAAAAAAABgEAAAAAAAAAAAAABUEAAAABAAAIgQAAAAAAAAAA AAAHoQAAAIEAAA
AAAAAAAAAAAAAAAAAAAAAAAAAABVU0VSMzIuZGxsAABoEAAAAA AAAAAAU2V0V2lu
ZG93VGV4dEEAAEtFUk5FTDMyLmRsbAAAmBAAAKoQAAC+EAAAAA AAAAAAR2V0Q29t
bWFuZExpbmVBAAAAR2V0Q29uc29sZVdpbmRvdwAAAABFeGl0UH JvY2VzcwD/FQgQ
QAAx0khAgDgAdBGAOCJ1AvfSCdJ174A4IHXqQFD/FQwQQABQ/xUAEEAAagD/FRAQ
QAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAA==
-----END CERTIFICATE-----

:::::::::::::::::::::::::::::::::::::::::::::::::: ::::::::::::::
:::::::::::::::::::::::::::::::::::::::::::::::::: ::::::::::::::
:::::::::::::::::::::::::::::::::::::::::::::::::: ::::::::::::::

The source code:

winmain::

jsr.l (GetCommandLine)
; skip program name
eor.l r1,r1 ; not within "" flag
dec.l r0
_20: inc.l r0
cmp.b #0,(r0)
beq.b _10
cmp.b #'"',(r0)
bne.b _30
not.l r1
_30: or.l r1,r1
bne.b _20
cmp.b #' ',(r0)
bne.b _20
inc.l r0

_10: move.l r0,-(sp)
jsr.l (GetConsoleWindow)
move.l r0,-(sp)
jsr.l (SetWindowTextA)
moveq.l #0,-(sp)
jsr.l (ExitProcess) ; exit program
  #6  
Old September 21st 18, 04:17 PM posted to alt.msdos.batch,alt.windows7.general
pyotr filipivich
external usenet poster
 
Posts: 752
Default how to get the title into task manger 'window'?

Herbert Kleebauer on Thu, 20 Sep 2018 21:58:37 +0200
typed in alt.windows7.general the following:

The source code:

winmain::

jsr.l (GetCommandLine)
; skip program name
eor.l r1,r1 ; not within "" flag
dec.l r0
_20: inc.l r0
cmp.b #0,(r0)
beq.b _10
cmp.b #'"',(r0)
bne.b _30
not.l r1
_30: or.l r1,r1
bne.b _20
cmp.b #' ',(r0)
bne.b _20
inc.l r0

_10: move.l r0,-(sp)
jsr.l (GetConsoleWindow)
move.l r0,-(sp)
jsr.l (SetWindowTextA)
moveq.l #0,-(sp)
jsr.l (ExitProcess) ; exit program


Hmmm - where/how do I put/use/invoke this?
--
pyotr filipivich
Next month's Panel: Graft - Boon or blessing?
  #7  
Old September 21st 18, 05:10 PM posted to alt.msdos.batch,alt.windows7.general
Paul[_32_]
external usenet poster
 
Posts: 11,873
Default how to get the title into task manger 'window'?

pyotr filipivich wrote:
Herbert Kleebauer on Thu, 20 Sep 2018 21:58:37 +0200
typed in alt.windows7.general the following:
The source code:

winmain::

jsr.l (GetCommandLine)
; skip program name
eor.l r1,r1 ; not within "" flag
dec.l r0
_20: inc.l r0
cmp.b #0,(r0)
beq.b _10
cmp.b #'"',(r0)
bne.b _30
not.l r1
_30: or.l r1,r1
bne.b _20
cmp.b #' ',(r0)
bne.b _20
inc.l r0

_10: move.l r0,-(sp)
jsr.l (GetConsoleWindow)
move.l r0,-(sp)
jsr.l (SetWindowTextA)
moveq.l #0,-(sp)
jsr.l (ExitProcess) ; exit program


Hmmm - where/how do I put/use/invoke this?


That looks like asm country (assembler).

Herbert mentions "SetWindowTextA" and user32.dll,
so you'll at least need to link those in.

https://stackoverflow.com/questions/...n32-executable

HTH,
Paul
  #8  
Old September 21st 18, 08:00 PM posted to alt.msdos.batch,alt.windows7.general
Herbert Kleebauer
external usenet poster
 
Posts: 27
Default how to get the title into task manger 'window'?

On 21.09.2018 17:17, pyotr filipivich wrote:
Herbert Kleebauer on Thu, 20 Sep 2018 21:58:37 +0200
typed in alt.windows7.general the following:


The source code:

winmain::

jsr.l (GetCommandLine)



Hmmm - where/how do I put/use/invoke this?


Just execute the posted batch file. The binary of the
program is generated on the fly from the batch code
(using certutil to decode the base64 data at the end
of the file). Remove the "del settitle.exe" line if
you want to save the exe file.


  #9  
Old September 23rd 18, 05:20 PM posted to alt.msdos.batch,alt.windows7.general
Brian Gregory[_2_]
external usenet poster
 
Posts: 166
Default how to get the title into task manger 'window'?

On 20/09/2018 20:58, Herbert Kleebauer wrote:
winmain::

Â*Â*Â*Â*Â*Â*Â* jsr.lÂ*Â* (GetCommandLine)
Â*Â*Â*Â*Â*Â*Â*Â*Â*Â*Â*Â*Â*Â*Â*Â*Â*Â*Â*Â*Â*Â*Â*Â*Â* Â*Â*Â*Â*Â*Â* ; skip program name
Â*Â*Â*Â*Â*Â*Â* eor.lÂ*Â* r1,r1Â*Â*Â*Â*Â*Â*Â*Â*Â*Â* ; not within "" flag
Â*Â*Â*Â*Â*Â*Â* dec.lÂ*Â* r0
_20:Â*Â*Â* inc.lÂ*Â* r0
Â*Â*Â*Â*Â*Â*Â* cmp.bÂ*Â* #0,(r0)
Â*Â*Â*Â*Â*Â*Â* beq.bÂ*Â* _10
Â*Â*Â*Â*Â*Â*Â* cmp.bÂ*Â* #'"',(r0)
Â*Â*Â*Â*Â*Â*Â* bne.bÂ*Â* _30
Â*Â*Â*Â*Â*Â*Â* not.lÂ*Â* r1
_30:Â*Â*Â* or.lÂ*Â*Â* r1,r1
Â*Â*Â*Â*Â*Â*Â* bne.bÂ*Â* _20
Â*Â*Â*Â*Â*Â*Â* cmp.bÂ*Â* #' ',(r0)
Â*Â*Â*Â*Â*Â*Â* bne.bÂ*Â* _20
Â*Â*Â*Â*Â*Â*Â* inc.lÂ*Â* r0

_10:Â*Â*Â* move.lÂ* r0,-(sp)
Â*Â*Â*Â*Â*Â*Â* jsr.lÂ*Â* (GetConsoleWindow)
Â*Â*Â*Â*Â*Â*Â* move.lÂ* r0,-(sp)
Â*Â*Â*Â*Â*Â*Â* jsr.lÂ*Â* (SetWindowTextA)
Â*Â*Â*Â*Â*Â*Â* moveq.l #0,-(sp)
Â*Â*Â*Â*Â*Â*Â* jsr.lÂ*Â* (ExitProcess)Â*Â* ; exit program


Is that really what Intel assembler looks like nowadays?

Looks more like Motorola 68000 assembler to me.

--

Brian Gregory (in England).
  #10  
Old September 23rd 18, 09:32 PM posted to alt.msdos.batch,alt.windows7.general
Kerr-Mudd,John
external usenet poster
 
Posts: 19
Default how to get the title into task manger 'window'?

On Sun, 23 Sep 2018 16:20:00 GMT, Brian Gregory
wrote:

On 20/09/2018 20:58, Herbert Kleebauer wrote:
winmain::

Â*Â*Â*Â*Â*Â*Â* jsr.lÂ*Â* (GetCommandLine)
Â*Â*Â*Â*Â*Â*Â*Â*Â*Â*Â*Â*Â*Â*Â*Â*Â*Â*Â*Â*Â*Â*Â*Â*Â* Â*Â*Â*Â*Â*Â* ;
skip program name Â*Â*Â*Â*Â*Â*Â* eor.lÂ*Â* r1,r1Â*Â*Â*Â*Â*Â*Â*Â*Â*Â*
; not within "" flag Â*Â*Â*Â*Â*Â*Â* dec.lÂ*Â* r0
_20:Â*Â*Â* inc.lÂ*Â* r0
Â*Â*Â*Â*Â*Â*Â* cmp.bÂ*Â* #0,(r0)
Â*Â*Â*Â*Â*Â*Â* beq.bÂ*Â* _10
Â*Â*Â*Â*Â*Â*Â* cmp.bÂ*Â* #'"',(r0)
Â*Â*Â*Â*Â*Â*Â* bne.bÂ*Â* _30
Â*Â*Â*Â*Â*Â*Â* not.lÂ*Â* r1
_30:Â*Â*Â* or.lÂ*Â*Â* r1,r1
Â*Â*Â*Â*Â*Â*Â* bne.bÂ*Â* _20
Â*Â*Â*Â*Â*Â*Â* cmp.bÂ*Â* #' ',(r0)
Â*Â*Â*Â*Â*Â*Â* bne.bÂ*Â* _20
Â*Â*Â*Â*Â*Â*Â* inc.lÂ*Â* r0

_10:Â*Â*Â* move.lÂ* r0,-(sp)
Â*Â*Â*Â*Â*Â*Â* jsr.lÂ*Â* (GetConsoleWindow)
Â*Â*Â*Â*Â*Â*Â* move.lÂ* r0,-(sp)
Â*Â*Â*Â*Â*Â*Â* jsr.lÂ*Â* (SetWindowTextA)
Â*Â*Â*Â*Â*Â*Â* moveq.l #0,-(sp)
Â*Â*Â*Â*Â*Â*Â* jsr.lÂ*Â* (ExitProcess)Â*Â* ; exit program


Is that really what Intel assembler looks like nowadays?

Looks more like Motorola 68000 assembler to me.


Not quite, with those Â's in it!
Herbert prefers Motorola syntax.

But it's not complicated; this is what I think it'd be in nasm format:

xor bx,bx ;instr flag =false
dec si
_20:
inc si
cmp byte [si],0
jz _10
cmp byte [si],'"'
jne _30
not bx ; flag as instr
_30:
or bx,bx
jne _20
cmp byte [si],' '
jne _20
inc si
_10:

I'd make the first one a 'lodsb', then test al.
so
mov ah,0 ; quoted str flag off
nextc:
lodsb
cmp al,0
je havestr
cmp al,'"'
jne notaquote
mov ah,1
notaquote:
cmp ah,1
jne nextc
cmp al,0x20 ; space
jne nextc
inc si ; skip it
havestr:


--
Bah, and indeed, Humbug.
  #11  
Old September 23rd 18, 05:08 PM posted to alt.msdos.batch,alt.windows7.general
Brian Gregory[_2_]
external usenet poster
 
Posts: 166
Default how to get the title into task manger 'window'?

On 19/09/2018 23:09, pyotr filipivich wrote:
how do I get "Administrator" to a) go away,


"Administrator:" shows it's running with elevated privileges (equivalent
to right click "Run as administrator".

Is that what you intended?

--

Brian Gregory (in England).
  #12  
Old September 24th 18, 09:25 PM posted to alt.msdos.batch,alt.windows7.general
pyotr filipivich
external usenet poster
 
Posts: 752
Default how to get the title into task manger 'window'?

Brian Gregory on Sun, 23 Sep
2018 17:08:52 +0100 typed in alt.windows7.general the following:
On 19/09/2018 23:09, pyotr filipivich wrote:
how do I get "Administrator" to a) go away,


"Administrator:" shows it's running with elevated privileges (equivalent
to right click "Run as administrator".

Is that what you intended?


What I get/see is "Adminis..." on the task bar
the window title is "Administrator: batch-file title here"

What I'd like is to be able to look at the taskbar, and not see
"Admins...", either because it now reads "Ad: batch-file title here"
or just "batch-file title here"
--
pyotr filipivich
Next month's Panel: Graft - Boon or blessing?
  #13  
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.
  #14  
Old September 20th 18, 01:18 AM posted to alt.msdos.batch,alt.windows7.general
pyotr filipivich
external usenet poster
 
Posts: 752
Default how to get the title into task manger 'window'?

VanguardLH on Wed, 19 Sep 2018 17:34:01 -0500 typed in
alt.windows7.general the following:
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.


Be still my beating heart.

No! Wait! not that still! (Ka-thump)
--
pyotr filipivich
Next month's Panel: Graft - Boon or blessing?
  #15  
Old September 19th 18, 07:40 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'?

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.


Give the batch file a title when you run it, like:

start "title" parms your.bat

To see the syntax for the 'start' function, run 'start /?' at the
command line. 'start' is an internal function within the command
interpreter (cmd.exe). Sometimes you get "unknown command" if you just
start the command line with 'start' (because whatever is the handler
doesn't know you are entering a function from within cmd.exe). In that
case, use:

cmd /c start "title" parms your.bat
^__ or /k depending on how you want the shell to handle stdout

Remember to enclose the batch file within double quotes if its path or
file name have space characters.

The window title will have a title of "batfilename - title". You
see "Administrator - batfilename" if you are running the batch file
inside the same command shell (which, in your case, was opened with
admin privs) instead of loading another shell. If you want the new
window opened by 'start' to close when the batch file ends, add 'exit'
at the end of your batch file.

--


Not a valid signature delimiter line. You used "dash dash space space"
but a correct sigline is "dash dash space". Just one trailing space.
 




Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off






All times are GMT +1. The time now is 04:34 AM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 PCbanter.
The comments are property of their posters.