PDA

View Full Version : Fixed Vista ICONS in System Tray



IronBits
04-21-2009, 12:33 AM
I finally figured out away to control the ICON that is used when you start a client in Vista.
Vista likes to use the last ICON it saw in the System Tray, don't know why, but that's what it does, so to make it use an icon you like, I run task manager first, then start the clients
This also works in Windows XP 64bit to. :)

I'll share my script that I use to run 8 cores, can be edited for less cores easily.

@echo off
start taskmgr.exe
sleep 3
start "NPLB-1" /D D:\dcprojects\NPLB\Port8000\NPLB1 /I /AFFINITY 1 cmd.exe /C llrnet.exe
start "NPLB-2" /D D:\dcprojects\NPLB\Port8000\NPLB2 /I /AFFINITY 2 cmd.exe /C llrnet.exe
start "NPLB-3" /D D:\dcprojects\NPLB\Port8000\NPLB3 /I /AFFINITY 4 cmd.exe /C llrnet.exe
start "NPLB-4" /D D:\dcprojects\NPLB\Port8000\NPLB4 /I /AFFINITY 8 cmd.exe /C llrnet.exe
start "NPLB-5" /D D:\dcprojects\NPLB\Port8000\NPLB5 /I /AFFINITY 10 cmd.exe /C llrnet.exe
start "NPLB-6" /D D:\dcprojects\NPLB\Port8000\NPLB6 /I /AFFINITY 20 cmd.exe /C llrnet.exe
start "NPLB-7" /D D:\dcprojects\NPLB\Port8000\NPLB7 /I /AFFINITY 40 cmd.exe /C llrnet.exe
start "NPLB-8" /D D:\dcprojects\NPLB\Port8000\NPLB8 /I /AFFINITY 80 cmd.exe /C llrnet.exe
taskkill /im taskmgr.exe

By doing this, I get 8 task manager icons in the System Tray.
I also spend the few minutes to change the window size for each one, drag it where I want it, then save it. (you only have to do this once)
75 wide 8 tall - allows me to fit them all on the screen 1280x1024, one on top of the other.
If you use grouping, you can minimize the group, or, close the group to terminate them.

Razor_FX_II
04-21-2009, 02:50 AM
What does the "/I" do in this line?

start "NPLB-1" /D D:\dcprojects\NPLB\Port8000\NPLB1 /I /AFFINITY 1 cmd.exe /C llrnet.exe

IronBits
04-21-2009, 03:00 AM
The new environment will be the original environment passed to the cmd.exe and not the current environment.


start /?

Starts a separate window to run a specified program or command.

START ["title"] [/D path] [/i] [/MIN] [/MAX] [/SEPARATE | /SHARED]
[/LOW | /NORMAL | /HIGH | /REALTIME | /ABOVENORMAL | /BELOWNORMAL]
[/AFFINITY <hex affinity>] [/WAIT] [/b] [command/program]
[parameters]

"title" Title to display in window title bar.
path Starting directory
B Start application without creating a new window. The
application has ^C handling ignored. Unless the application
enables ^C processing, ^Break is the only way to interrupt
the application
I The new environment will be the original environment passed
to the cmd.exe and not the current environment.
MIN Start window minimized
MAX Start window maximized
SEPARATE Start 16-bit Windows program in separate memory space
SHARED Start 16-bit Windows program in shared memory space
LOW Start application in the IDLE priority class
NORMAL Start application in the NORMAL priority class
HIGH Start application in the HIGH priority class
REALTIME Start application in the REALTIME priority class
ABOVENORMAL Start application in the ABOVENORMAL priority class
BELOWNORMAL Start application in the BELOWNORMAL priority class
AFFINITY The new application will have the specified processor
affinity mask, expressed as a hexadecimal number.
WAIT Start application and wait for it to terminate
command/program
If it is an internal cmd command or a batch file then
the command processor is run with the /K switch to cmd.exe.
This means that the window will remain after the command
has been run.

If it is not an internal cmd command or batch file then
it is a program and will run as either a windowed application
or a console application.

parameters These are the parameters passed to the command/program

NOTE: The SEPERATE and SHARED options are not supported on 64-bit platforms.

If Command Extensions are enabled, external command invocation
through the command line or the START command changes as follows:

non-executable files may be invoked through their file association just
by typing the name of the file as a command. (e.g. WORD.DOC would
launch the application associated with the .DOC file extension).
See the ASSOC and FTYPE commands for how to create these
associations from within a command script.

When executing an application that is a 32-bit GUI application, CMD.EXE
does not wait for the application to terminate before returning to
the command prompt. This new behavior does NOT occur if executing
within a command script.

When executing a command line whose first token is the string "CMD "
without an extension or path qualifier, then "CMD" is replaced with
the value of the COMSPEC variable. This prevents picking up CMD.EXE
from the current directory.

When executing a command line whose first token does NOT contain an
extension, then CMD.EXE uses the value of the PATHEXT
environment variable to determine which extensions to look for
and in what order. The default value for the PATHEXT variable
is:

.COM;.EXE;.BAT;.CMD

Notice the syntax is the same as the PATH variable, with
semicolons separating the different elements.

When searching for an executable, if there is no match on any extension,
then looks to see if the name matches a directory name. If it does, the
START command launches the Explorer on that path. If done from the
command line, it is the equivalent to doing a CD /D to that path.
If you have spaces in your directory structure, then something like this should work for you to
start "NPLB-1" /D "C:\NPLB\Port 8000\NPLB1" /I /AFFINITY 1 cmd.exe /C llrnet.exe

If you want to start it minimized you can use this
start "NPLB-1" /D "C:\NPLB\Port 8000\NPLB1" /I /MIN /AFFINITY 1 cmd.exe /C llrnet.exe

/AFFINITY only works with Vista 64bit or Windows XP 64bit.

To run it on 32bit windows/Vista, you should use something like this
start "NPLB-1" /D "C:\NPLB\Port 8000\NPLB1" /I /MIN cmd.exe /C llrnet.exe

Razor_FX_II
04-21-2009, 03:10 AM
Thanks

Digital Parasite
04-21-2009, 11:25 AM
Are you using Affinity 1, 2, 4, 8 because of the hypthreading on your core i7 or what would us regular Core2 people be using for a quad-core?

IronBits
04-22-2009, 09:00 PM
Cores are cpus to the OS, HT is done by the cpu to fool the OS into seeing more than there really is.
If you have 8 real cores or 4 real cores + 4 HT cores, they both have 8 CPUs to the OS.
Use as many of the lines you need to match the cores the OS finds.

2 cores worth
start "NPLB-1" /D D:\dcprojects\NPLB\Port8000\NPLB1 /I /AFFINITY 1 cmd.exe /C llrnet.exe
start "NPLB-2" /D D:\dcprojects\NPLB\Port8000\NPLB2 /I /AFFINITY 2 cmd.exe /C llrnet.exe

4 cores worth
start "NPLB-1" /D D:\dcprojects\NPLB\Port8000\NPLB1 /I /AFFINITY 1 cmd.exe /C llrnet.exe
start "NPLB-2" /D D:\dcprojects\NPLB\Port8000\NPLB2 /I /AFFINITY 2 cmd.exe /C llrnet.exe
start "NPLB-3" /D D:\dcprojects\NPLB\Port8000\NPLB3 /I /AFFINITY 4 cmd.exe /C llrnet.exe
start "NPLB-4" /D D:\dcprojects\NPLB\Port8000\NPLB4 /I /AFFINITY 8 cmd.exe /C llrnet.exe

6 cores worth
start "NPLB-1" /D D:\dcprojects\NPLB\Port8000\NPLB1 /I /AFFINITY 1 cmd.exe /C llrnet.exe
start "NPLB-2" /D D:\dcprojects\NPLB\Port8000\NPLB2 /I /AFFINITY 2 cmd.exe /C llrnet.exe
start "NPLB-3" /D D:\dcprojects\NPLB\Port8000\NPLB3 /I /AFFINITY 4 cmd.exe /C llrnet.exe
start "NPLB-4" /D D:\dcprojects\NPLB\Port8000\NPLB4 /I /AFFINITY 8 cmd.exe /C llrnet.exe
start "NPLB-5" /D D:\dcprojects\NPLB\Port8000\NPLB5 /I /AFFINITY 10 cmd.exe /C llrnet.exe
start "NPLB-6" /D D:\dcprojects\NPLB\Port8000\NPLB6 /I /AFFINITY 20 cmd.exe /C llrnet.exe

8 cores worth
start "NPLB-1" /D D:\dcprojects\NPLB\Port8000\NPLB1 /I /AFFINITY 1 cmd.exe /C llrnet.exe
start "NPLB-2" /D D:\dcprojects\NPLB\Port8000\NPLB2 /I /AFFINITY 2 cmd.exe /C llrnet.exe
start "NPLB-3" /D D:\dcprojects\NPLB\Port8000\NPLB3 /I /AFFINITY 4 cmd.exe /C llrnet.exe
start "NPLB-4" /D D:\dcprojects\NPLB\Port8000\NPLB4 /I /AFFINITY 8 cmd.exe /C llrnet.exe
start "NPLB-5" /D D:\dcprojects\NPLB\Port8000\NPLB5 /I /AFFINITY 10 cmd.exe /C llrnet.exe
start "NPLB-6" /D D:\dcprojects\NPLB\Port8000\NPLB6 /I /AFFINITY 20 cmd.exe /C llrnet.exe
start "NPLB-7" /D D:\dcprojects\NPLB\Port8000\NPLB7 /I /AFFINITY 40 cmd.exe /C llrnet.exe
start "NPLB-8" /D D:\dcprojects\NPLB\Port8000\NPLB8 /I /AFFINITY 80 cmd.exe /C llrnet.exe

PCZ
04-23-2009, 02:39 AM
DP
Dont worry too much about the affinity.
Vista does have an option to set it on the command line, but it isn't necessary in most cases.

Just fire up 4 clients and they will get a core each.
The OS will move the clients from core to core as it sees fit, this has a very minor negative effect on the output.

On a dedicated cruncher setting affinity is an option that may yeald slightly more output. The clients stay nailed to individual cores.

Digital Parasite
04-23-2009, 10:20 AM
Cores are cpus to the OS, HT is done by the cpu to fool the OS into seeing more than there really is.
If you have 8 real cores or 4 real cores + 4 HT cores, they both have 8 CPUs to the OS.Use as many of the lines you need to match the cores the OS finds.

4 cores worth
start "NPLB-1" /D D:\dcprojects\NPLB\Port8000\NPLB1 /I /AFFINITY 1 cmd.exe /C llrnet.exe
start "NPLB-2" /D D:\dcprojects\NPLB\Port8000\NPLB2 /I /AFFINITY 2 cmd.exe /C llrnet.exe
start "NPLB-3" /D D:\dcprojects\NPLB\Port8000\NPLB3 /I /AFFINITY 4 cmd.exe /C llrnet.exe
start "NPLB-4" /D D:\dcprojects\NPLB\Port8000\NPLB4 /I /AFFINITY 8 cmd.exe /C llrnet.exe


I realize that but why wouldn't you use affinity 1, 2, 3, 4 for a 4 core system? Why the 1, 2, 4, 8?

Jeff.

Digital Parasite
04-23-2009, 10:22 AM
DP
Dont worry too much about the affinity.
Vista does have an option to set it on the command line, but it isn't necessary in most cases.

Just fire up 4 clients and they will get a core each.
The OS will move the clients from core to core as it sees fit, this has a very minor negative effect on the output.

Windows is pretty stupid in assigning CPUs I have found. If you fire up 1 client, you will see that none of the CPUs is using 100% that is because Vista is bouncing it around from CPU to CPU even though there is no load on the others. In Windows if you are running any DC stuff, it is a good idea if you can set the affinity so things stay put.

I was just asking IronBits about his affinity numbers because they seemed strange to me so I was thinking maybe he used that to avoid setting them to a hyper-threaded "core".

Jeff.

PCZ
04-23-2009, 01:42 PM
If you start up 4 clients on a quad then all the cores get used.
Setting the affinity is not required.

It is one of those myths that seem to perpetuate around DC forums.

Digital Parasite
04-23-2009, 02:25 PM
If you start up 4 clients on a quad then all the cores get used. Setting the affinity is not required.

It is one of those myths that seem to perpetuate around DC forums.

I don't think you get what I'm saying. Windows is not smart about allocating processes to processors. Of course if you start 4 clients all 4 cores will get used, but they may get swapped around by Windows needlessly. So it is more efficient to set the affinity if you can. The scheduler is designed to handle processes that come and go, grow and fall in load, not really optimized for processes that stay loaded 24/7.

The only thing I'm curious about is why IronBits uses 1,2,4,8 for his affinity selection on a quad-core instead of 1,2,3,4. I'm just trying to find out if I'm missing something obvious.

PCZ
04-23-2009, 04:09 PM
I'm curious to know what the performance is like with and without hyperthreading.
Wonder if his odd affinity settings have something to do with this. ?

IronBits
04-23-2009, 08:02 PM
Not using HT is about the same as using HT, with HT being somewhat faster.
Buy one and let us know how you make out :p ;)

DP - for example with 4 cores
1 uses CPU0
2 uses CPU1
3 uses CPU0 and CPU1
4 uses CPU2
5 uses CPU0 and CPU2
6 uses CPU1 and CPU2
7 uses CPU0, CPU1, and CPU2
8 uses CPU3
9 uses CPU0 and CPU3
10 uses CPU0, CPU1, CPU2, CPU3


Convert the number to hex and reverse it to see which CPUs are to be used.

pfb
04-23-2009, 08:13 PM
The only thing I'm curious about is why IronBits uses 1,2,4,8 for his affinity selection on a quad-core instead of 1,2,3,4. I'm just trying to find out if I'm missing something obvious.


The affinity flag is a hex mask which is why it doesn't go 1,2,3,4 - the info about start IB posted did have this but didn't go into what each flag mask corresponded to...

Handy bit of info imo - didn't realise start had this under Vista (but then don't really do much that needs affinitys changing but still handy to know :))

IronBits
04-23-2009, 10:42 PM
BitMask CPU's
========= =========
00000001 1st CPU
00000010 2nd CPU
00000100 3rd CPU
00001000 4th CPU
00010000 5th CPU
00100000 6th CPU
01000000 7th CPU
10000000 8th CPU
By combining these BIT values one can determine the CPU count/mask.
The BitMask is 32 bits in size, so theoretically the BitMask supports up to 32 CPU's.

Example: BitMask=00000011 would mean 2 CPU's, number 1 and 2.

http://technet.microsoft.com/en-us/library/cc778499.aspx

IronBits
04-23-2009, 11:10 PM
Another way of putting it...
1 = CPU 0
2 = CPU 1
4 = CPU 2
8 = CPU 3
10 = CPU 4
20 = CPU 5
40 = CPU 6
80 = CPU 7
hexadecimal = CPU # (it's zero based) starts with core 0, which is your 1st CPU. (Think SCSI ;) )

Does that help ?
Works in Windows XP 64bit and Vista 64bit OS.
Now you don't need 3rd party utilities to manage your affinity :D

PCZ
04-24-2009, 05:03 AM
Large bell ringing. i used those mask numbers with the F@H GPU client.

IB
I just priced one up.
Bare bones

Sub Total: £471.27
Shipping: £16.25
Total Vat: £73.13
Total inc Vat: £560.65


edit:
Look what you made me do
I did hit the buy button.

Postman better turn up tommorow

Digital Parasite
04-24-2009, 05:52 AM
DP - for example with 4 cores
1 uses CPU0
2 uses CPU1
3 uses CPU0 and CPU1
4 uses CPU2
5 uses CPU0 and CPU2
6 uses CPU1 and CPU2
7 uses CPU0, CPU1, and CPU2
8 uses CPU3
9 uses CPU0 and CPU3
10 uses CPU0, CPU1, CPU2, CPU3

Convert the number to hex and reverse it to see which CPUs are to be used.

Ah ok now I understand, that info is exactly what I was looking for. Wow, Vista/XP64 is more advanced than I thought. I didn't realize you could set the affinity for groups of processors as well as just 1 or all. Interesting.

Thanks for the info.
Jeff.

PCZ
04-24-2009, 06:02 AM
Affinity works that way in Windows 7 as well.

The taskbar icon is all messed up in W7.
It has no text when you click on it.
GUI monitor seems to work if you can get it up.

Digital Parasite
04-24-2009, 08:49 AM
The script works great IB, thanks for posting it. I'm currently have an llrnet.exe that is 32bit and says:

LLR network client 0.9b7 (based on LLR version 3.5.0).

Is that the latest version? Is there a win64 version anywhere?

Jeff.