Setting process priority from the command line

  • Thread starter Thread starter Vic Walker
  • Start date Start date
V

Vic Walker

I have some large files I need to distribute over our LAN
to multiple users. I am trying to write a batch file I
could distribute to the users to automatically download
and install these files. However, if very many users run
the batch file at once, the LAN's bandwidth will be
overloaded.

If I were working in Unix, I could use the 'nice' command
to set the copying process to a low priority, which would
reduce the load on the LAN.

In Windows, I could run the batch file, then run the Task
Manager, right click the batch process to Go to the
Process, right click the CMD.EXE process to Set Priority,
and set the priority to BelowNormal or Low.

Is there a way to set (or reset) the priority in Windows
from a batch file, so I don't have to go through all that
right clicking?

Thanks very much for your help.

Vic Walker
 
Vic Walker said:
Is there a way to set (or reset) the priority in Windows from a batch
file, so I don't have to go through all that right clicking?

Use cmd's start command. See start /? for details.

START ["title"] [/Dpath] [/I] [/MIN] [/MAX] [/SEPARATE | /SHARED]
[/LOW | /NORMAL | /HIGH | /REALTIME | /ABOVENORMAL | /BELOWNORMAL]
[/WAIT] [/B] [command/program]
[parameters]

Regards,

Bill
 
Bill, thanks very much!

Vic
-----Original Message-----
Vic Walker said:
Is there a way to set (or reset) the priority in Windows from a batch
file, so I don't have to go through all that right
clicking?

Use cmd's start command. See start /? for details.

START ["title"] [/Dpath] [/I] [/MIN] [/MAX] [/SEPARATE | /SHARED]
[/LOW | /NORMAL | /HIGH | /REALTIME | /ABOVENORMAL | /BELOWNORMAL]
[/WAIT] [/B] [command/program]
[parameters]

Regards,

Bill


.
 
Bill Stewart said:
Vic Walker said:
Is there a way to set (or reset) the priority in Windows from a batch
file, so I don't have to go through all that right clicking?

Use cmd's start command. See start /? for details.

START ["title"] [/Dpath] [/I] [/MIN] [/MAX] [/SEPARATE | /SHARED]
[/LOW | /NORMAL | /HIGH | /REALTIME | /ABOVENORMAL | /BELOWNORMAL]
[/WAIT] [/B] [command/program]
[parameters]

While that certainly seems like a reasonable thing to do, what is the actual
effect on LAN bandwidth?

This "priority" refers to relative priority of the application running on
the workstation - the help text says that /LOW causes the application to
start in the "idle" class. If all of the users run the batch and wait for it
to complete, perhaps it will have little effect if they are not running
something else that is making significant demands on the workstation.

But, even then, whatever it is that determines when the application gets its
time slices has nothing whatsoever to do with network loads.

/Al
 
Vic Walker said:
I have some large files I need to distribute over our LAN
to multiple users. I am trying to write a batch file I
could distribute to the users to automatically download
and install these files. However, if very many users run
the batch file at once, the LAN's bandwidth will be
overloaded.

Do you know this for a fact?
If I were working in Unix, I could use the 'nice' command
to set the copying process to a low priority, which would
reduce the load on the LAN.

Does the low priority of the 'nice' command actually take LAN bandwidth into
account, or just the processor load on the local machine?
In Windows, I could run the batch file, then run the Task
Manager, right click the batch process to Go to the
Process, right click the CMD.EXE process to Set Priority,
and set the priority to BelowNormal or Low.

Is there a way to set (or reset) the priority in Windows
from a batch file, so I don't have to go through all that
right clicking?

That particular question was answered by Bill Stewart. Here is an answer to
your original implied question of: "how can I code a file downloading batch
file in such a way as to limit effect on bandwidth?"

First, determine how many concurrenty copy operations your LAN is likely to
support. Then create a share and specify this number (or less) as the
maximum number of "users" (i.e. of concurrent mapings). Then code your batch
file something like this:

net use X: \\server\share
if not exist M: (
echo/
echo/Unable to download files now due to
echo/network activity. Please try later.
echo/
) else (
xcopy /s X:\*.* C:\download\
net use X: /del
)

If you don't want to have to require the user to manually retry like this,
then code your main batch to start a variation of the above (at low
priority, if you like), and modify it to keep trying to map the share like
this:

:mapshare
net use X: \\server\share
if not exist M: (
ping -n 11 127.0.0.1
goto:mapshare
)
xcopy /s X:\*.* C:\download\
net use X: /del


/Al
 
Back
Top