Batch File to Run .exe and set priority
Moderator: DosItHelp
-
- Posts: 5
- Joined: 02 Dec 2016 00:11
Batch File to Run .exe and set priority
Objective: Open the prw.exe process then apply "High priority or "realtime" to the application.exe
Windows 7 Professional 64 bit
Program Utilizes Drive Z: for a network path to run, it must patch an update first before the program will execute.
Batch File:
"C:\Program Files (x86)\Mckesson\Practice Partner\prw.exe"
Fails to open unable to connect to C tree server.
Desktop Icon is named Patient Records.Ink
Full File Path of Ink File is:
"C:\Program Files (x86)\McKesson\Practice Partner\Updater\"
However, the process itself that opens after the update attempt is still prw.exe, which full path file is: "C:\Program Files (x86)\Mckesson\Practice Partner\prw.exe"
Partial Success.
wmic process where name="prw.exe" CALL setpriority "realtime"
If I manually open the application this part of the batch file works.
I cannot get the file to open through a batch file. Much help appreciated.
Windows 7 Professional 64 bit
Program Utilizes Drive Z: for a network path to run, it must patch an update first before the program will execute.
Batch File:
"C:\Program Files (x86)\Mckesson\Practice Partner\prw.exe"
Fails to open unable to connect to C tree server.
Desktop Icon is named Patient Records.Ink
Full File Path of Ink File is:
"C:\Program Files (x86)\McKesson\Practice Partner\Updater\"
However, the process itself that opens after the update attempt is still prw.exe, which full path file is: "C:\Program Files (x86)\Mckesson\Practice Partner\prw.exe"
Partial Success.
wmic process where name="prw.exe" CALL setpriority "realtime"
If I manually open the application this part of the batch file works.
I cannot get the file to open through a batch file. Much help appreciated.
-
- Posts: 128
- Joined: 23 May 2016 15:39
- Location: Spain
Re: Batch File to Run .exe and set priority
may be...
once you know it works, replace @echo ON with @echo off
not sure if I understand, if you need a mapped drive, try
Code: Select all
@echo ON
start /B "" cmd /c "C:\Program Files (x86)\Mckesson\Practice Partner\prw.exe"
wmic process where name="prw.exe" CALL setpriority "realtime"
once you know it works, replace @echo ON with @echo off
not sure if I understand, if you need a mapped drive, try
Code: Select all
@echo ON
subst z: "c:\somePath\someSubFolder" & rem or subst z: "\\someMachine\someSharedDevice"
start /B "" cmd /c "C:\Program Files (x86)\Mckesson\Practice Partner\prw.exe"
wmic process where name="prw.exe" CALL setpriority "realtime"
-
- Posts: 5
- Joined: 02 Dec 2016 00:11
Re: Batch File to Run .exe and set priority
@echo ON
start /B "" cmd /c "C:\Program Files (x86)\Mckesson\Practice Partner\prw.exe"
wmic process where name="prw.exe" CALL setpriority "realtime"
Still same result.
So to help on the confusion with the Z: drive, Its always mapped at startup. The application file pulls from the Z: Drive to check for patches and updates from the server.
Tried the
@echo ON
subst z: "c:\somePath\someSubFolder" & rem or subst z: "\\IP AddressorHostname\SharedFolder"
start /B "" cmd /c "C:\Program Files (x86)\Mckesson\Practice Partner\prw.exe"
wmic process where name="prw.exe" CALL setpriority "realtime"
Same result on this one
I attached the error it gives anything I can screenshot or do to help you help me?
start /B "" cmd /c "C:\Program Files (x86)\Mckesson\Practice Partner\prw.exe"
wmic process where name="prw.exe" CALL setpriority "realtime"
Still same result.
So to help on the confusion with the Z: drive, Its always mapped at startup. The application file pulls from the Z: Drive to check for patches and updates from the server.
Tried the
@echo ON
subst z: "c:\somePath\someSubFolder" & rem or subst z: "\\IP AddressorHostname\SharedFolder"
start /B "" cmd /c "C:\Program Files (x86)\Mckesson\Practice Partner\prw.exe"
wmic process where name="prw.exe" CALL setpriority "realtime"
Same result on this one
I attached the error it gives anything I can screenshot or do to help you help me?
- Attachments
-
- Error.JPG (45.86 KiB) Viewed 26199 times
Re: Batch File to Run .exe and set priority
Really not understanding what you are trying to do overall.
But I am confused as to why you are not setting the priority class with the START command?
But I am confused as to why you are not setting the priority class with the START command?
Code: Select all
W:\SecurityBenefit\Input\Customer>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]
[/NODE <NUMA node>] [/AFFINITY <hex affinity mask>] [/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.
NODE Specifies the preferred Non-Uniform Memory Architecture (NUMA)
node as a decimal integer.
AFFINITY Specifies the processor affinity mask as a hexadecimal number.
The process is restricted to running on these processors.
The affinity mask is interpreted differently when /AFFINITY and
/NODE are combined. Specify the affinity mask as if the NUMA
node's processor mask is right shifted to begin at bit zero.
The process is restricted to running on those processors in
common between the specified affinity mask and the NUMA node.
If no processors are in common, the process is restricted to
running on the specified NUMA node.
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 SEPARATE and SHARED options are not supported on 64-bit platforms.
Specifying /NODE allows processes to be created in a way that leverages memory
locality on NUMA systems. For example, two processes that communicate with
each other heavily through shared memory can be created to share the same
preferred NUMA node in order to minimize memory latencies. They allocate
memory from the same NUMA node when possible, and they are free to run on
processors outside the specified node.
start /NODE 1 application1.exe
start /NODE 1 application2.exe
These two processes can be further constrained to run on specific processors
within the same NUMA node. In the following example, application1 runs on the
low-order two processors of the node, while application2 runs on the next two
processors of the node. This example assumes the specified node has at least
four logical processors. Note that the node number can be changed to any valid
node number for that computer without having to change the affinity mask.
start /NODE 1 /AFFINITY 0x3 application1.exe
start /NODE 1 /AFFINITY 0xc application2.exe
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.
-
- Posts: 5
- Joined: 02 Dec 2016 00:11
Re: Batch File to Run .exe and set priority
Thank you so much for all this additional information it will help me in defining additional things to it after I get it working.
So The overall goal is I just want to open an .exe application with a batch file simply.
I can manually open the folder
C:\Program Files (x86)\Mckesson\Practice Partner\prw.exe
Prw.exe is the actual service aka process name after it runs.
Whenever I try to open it through a batch file it simply does not work. It attempts to open it but it says it cannot connect to the C tree server, which is stored on the Z Drive. Its almost like it does not know to look to the Z Drive. The application has 2 different launcher ICONS, one that is in C:\Program Files (x86)\Mckesson\Practice Partner\Updater folder
The other is in C:\Program Files (x86)\Mckesson\Practice Partner
I have tried both of them.
Is there something additional I must add to it for it to know that the ppart "C Tree server" is in the Z drive?
Like I can do:
c:\program files (x86)\bandicam\bandicam.exe
works perfect.
I do
C:\Program Files (x86)\Mckesson\Practice Partner\prw.exe
It says CAnnot find C tree server.
Hense the bandicam example just runs from the .exe
The Prw.exe actually connects to the Z drive because thats where it runs off the application server. I just dont understand why I can double click the icon and it launches but cant launch it through bat file.
What should I log or take pics of ?
So The overall goal is I just want to open an .exe application with a batch file simply.
I can manually open the folder
C:\Program Files (x86)\Mckesson\Practice Partner\prw.exe
Prw.exe is the actual service aka process name after it runs.
Whenever I try to open it through a batch file it simply does not work. It attempts to open it but it says it cannot connect to the C tree server, which is stored on the Z Drive. Its almost like it does not know to look to the Z Drive. The application has 2 different launcher ICONS, one that is in C:\Program Files (x86)\Mckesson\Practice Partner\Updater folder
The other is in C:\Program Files (x86)\Mckesson\Practice Partner
I have tried both of them.
Is there something additional I must add to it for it to know that the ppart "C Tree server" is in the Z drive?
Like I can do:
c:\program files (x86)\bandicam\bandicam.exe
works perfect.
I do
C:\Program Files (x86)\Mckesson\Practice Partner\prw.exe
It says CAnnot find C tree server.
Hense the bandicam example just runs from the .exe
The Prw.exe actually connects to the Z drive because thats where it runs off the application server. I just dont understand why I can double click the icon and it launches but cant launch it through bat file.
What should I log or take pics of ?
-
- Posts: 128
- Joined: 23 May 2016 15:39
- Location: Spain
Re: Batch File to Run .exe and set priority
may prw.exe has its own libraries in the home folder?, try
Code: Select all
@echo ON
start /realtime "" cmd /c "pushd "C:\Program Files (x86)\Mckesson\Practice Partner\" & "prw.exe" & popd"
Yes! I forgot such feature. I have used it!Squashman wrote:But I am confused as to why you are not setting the priority class with the START command?
Re: Batch File to Run .exe and set priority
elzooilogico wrote:may prw.exe has its own libraries in the home folder?, tryCode: Select all
@echo ON
start /realtime "" cmd /c "pushd "C:\Program Files (x86)\Mckesson\Practice Partner\" & "prw.exe" & popd"
That is overkill. Just use the /D option with the START command.
Should be able to just do this.
Code: Select all
start "" /realtime /D "C:\Program Files (x86)\Mckesson\Practice Partner\" "prw.exe"
-
- Posts: 5
- Joined: 02 Dec 2016 00:11
Re: Batch File to Run .exe and set priority
Squashman wrote:elzooilogico wrote:may prw.exe has its own libraries in the home folder?, tryCode: Select all
@echo ON
start /realtime "" cmd /c "pushd "C:\Program Files (x86)\Mckesson\Practice Partner\" & "prw.exe" & popd"
That is overkill. Just use the /D option with the START command.
Should be able to just do this.Code: Select all
start "" /realtime /D "C:\Program Files (x86)\Mckesson\Practice Partner\" "prw.exe"
Whoa. Solved.
Thank you much sir. I been trying to get this to work for days.
100% successful.
Thank you!!!!!!
Both of these options work wonderfully!
-
- Posts: 5
- Joined: 02 Dec 2016 00:11
Re: Batch File to Run .exe and set priority
Thank you all so much for your help, you guys are great!
palegathon wrote:Squashman wrote:elzooilogico wrote:may prw.exe has its own libraries in the home folder?, tryCode: Select all
@echo ON
start /realtime "" cmd /c "pushd "C:\Program Files (x86)\Mckesson\Practice Partner\" & "prw.exe" & popd"
That is overkill. Just use the /D option with the START command.
Should be able to just do this.Code: Select all
start "" /realtime /D "C:\Program Files (x86)\Mckesson\Practice Partner\" "prw.exe"
Whoa. Solved.
Thank you much sir. I been trying to get this to work for days.
100% successful.
Thank you!!!!!!
Both of these options work wonderfully!
-
- Posts: 128
- Joined: 23 May 2016 15:39
- Location: Spain
Re: Batch File to Run .exe and set priority
Squashman wrote:elzooilogico wrote:may prw.exe has its own libraries in the home folder?, tryCode: Select all
@echo ON
start /realtime "" cmd /c "pushd "C:\Program Files (x86)\Mckesson\Practice Partner\" & "prw.exe" & popd"
That is overkill. Just use the /D option with the START command.
Should be able to just do this.Code: Select all
start "" /realtime /D "C:\Program Files (x86)\Mckesson\Practice Partner\" "prw.exe"
Whoaaa! Next time I'll read help more carefully!!