|
View Full Version : start with /wait and /b together
jan_bar 10-04-2006, 04:06 PM Hi,
I want to start command line tool from a batch, keep the same command window
and wait for it at the same time. Sample:
start "test" /low /wait /b "path\to\some\command\line\tool.exe"
The problem is, that /wait and /b doesn't work together. When the /b is
specified, the /wait is ignored - and any Ctrl-C will nto reach the running
tool.exe. How can I solve this?
In fact, I just want to start the tool.exe with lower priority, start /low
seems to be the cheapest way.
Thanks, Jan
billious 10-04-2006, 05:06 PM "jan_bar" <nospam@nospam.nospam> wrote in message
news:OE$Z8a85GHA.1248@TK2MSFTNGP03.phx.gbl...
> Hi,
>
> I want to start command line tool from a batch, keep the same command
> window
> and wait for it at the same time. Sample:
>
> start "test" /low /wait /b "path\to\some\command\line\tool.exe"
>
> The problem is, that /wait and /b doesn't work together. When the /b is
> specified, the /wait is ignored - and any Ctrl-C will nto reach the
> running
> tool.exe. How can I solve this?
> In fact, I just want to start the tool.exe with lower priority, start /low
> seems to be the cheapest way.
>
> Thanks, Jan
>
>
So what you would want to do is
* set lower priority
* execute TOOL
* restore original priority
the problem being that a tool to set the priority from the command line
isn't supplied by Uncle Bill, and isn't an option in TASKMANAGER which is
dumbly clicky-clicky?
* beyondlogic.org has a freeware program that is claimed set priority of a
process. Google "command line change task priority"
-------------------
Perhaps you could split the batch into two, as the last command of the first
half "start" a new batchfile with LOW priority, containing just two lines:
TOOL
start /originalpriority secondpartoforiginalbatchfile
Mark V 10-04-2006, 10:42 PM In microsoft.public.win2000.cmdprompt.admin billious wrote:
>
> "jan_bar" <nospam@nospam.nospam> wrote in message
> news:OE$Z8a85GHA.1248@TK2MSFTNGP03.phx.gbl...
>> Hi,
>>
>> I want to start command line tool from a batch, keep the same
>> command window
>> and wait for it at the same time. Sample:
>>
>> start "test" /low /wait /b "path\to\some\command\line\tool.exe"
>>
>> The problem is, that /wait and /b doesn't work together. When
>> the /b is specified, the /wait is ignored - and any Ctrl-C will
>> nto reach the running
>> tool.exe. How can I solve this?
>> In fact, I just want to start the tool.exe with lower priority,
>> start /low seems to be the cheapest way.
>>
>> Thanks, Jan
>>
>>
>
> So what you would want to do is
>
> * set lower priority
> * execute TOOL
> * restore original priority
But I think OP needs to "wait". Why wait is unknown. Does the
TOOL return data? Or do you just need to know when it is finished?
In the latter case a loop with a process lister that exits when the
"tool" process ends might suffice for that. pslist.exe might be
useful as it sets errorlevel (found/not found).
> the problem being that a tool to set the priority from the
> command line isn't supplied by Uncle Bill, and isn't an option
> in TASKMANAGER which is dumbly clicky-clicky?
I think he said. START "" /LOW
would work?
> * beyondlogic.org has a freeware program that is claimed set
> priority of a process. Google "command line change task
> priority"
Interesting. I did not know of that one.
http://beyondlogic.org/solutions/processutil/processutil.htm
There is another
http://www.ntwind.com/software/utilities/hstart.html
Hidden Start (hstart)
I have not yet used it. It offers named class priority such as
"/IDLE".
And I have a vague recollection of one of the "process starter"
tools (forgotten which one) has a Priority argument available...
billious 10-05-2006, 06:51 AM "Mark V" <notvalid@nul.invalid> wrote in message
news:Xns9852B438CB1B4z9zzaQ2btw@msnews.microsoft.com...
> In microsoft.public.win2000.cmdprompt.admin billious wrote:
>
>>
>> "jan_bar" <nospam@nospam.nospam> wrote in message
>> news:OE$Z8a85GHA.1248@TK2MSFTNGP03.phx.gbl...
>>> Hi,
>>>
>>> I want to start command line tool from a batch, keep the same
>>> command window
>>> and wait for it at the same time. Sample:
>>>
>>> start "test" /low /wait /b "path\to\some\command\line\tool.exe"
>>>
>>> The problem is, that /wait and /b doesn't work together. When
>>> the /b is specified, the /wait is ignored - and any Ctrl-C will
>>> nto reach the running
>>> tool.exe. How can I solve this?
>>> In fact, I just want to start the tool.exe with lower priority,
>>> start /low seems to be the cheapest way.
>>>
>>> Thanks, Jan
>>>
>>>
>>
>> So what you would want to do is
>>
>> * set lower priority
>> * execute TOOL
>> * restore original priority
>
> But I think OP needs to "wait". Why wait is unknown. Does the
> TOOL return data? Or do you just need to know when it is finished?
>
> In the latter case a loop with a process lister that exits when the
> "tool" process ends might suffice for that. pslist.exe might be
> useful as it sets errorlevel (found/not found).
>
Why go to all that bother?
TOOL
will execute TOOL and wait until it's finished. The OP wants TOOL to be run
at LOW priority. WHY is beyond me - but that is what was asked.
>> the problem being that a tool to set the priority from the
>> command line isn't supplied by Uncle Bill, and isn't an option
>> in TASKMANAGER which is dumbly clicky-clicky?
>
> I think he said. START "" /LOW
> would work?
>
Yes - but it WON'T work with /B and will create a new window. I believe that
the idea is to have only one window and have the TOOL process running with
LOW priority.
This can be achieved by the following, given Demo1.bat is on the desktop -
I've used EDIT since we're not aware of what TOOL is.
----- batch demo1 begins -------
[1]@echo off
[2]start "" /low /max demo2.bat
[3]exit
------ batch demo1 ends --------
----- batch demo2 begins -------
[1]edit junk.txt
[2]start "" /normal /max demo3.bat
[3]exit
------ batch demo2 ends --------
----- batch demo3 begins -------
[1]echo now in demo3!
[2]pause
[3]exit
------ batch demo3 ends --------
Lines start [number] - any lines not starting [number] have been wrapped
and should be rejoined. The [number] that starts the line should be removed
jan_bar 10-05-2006, 08:28 AM Thank you Mark and "billious", let me clarify:
TOOL - Maven (command line Java project management framework)
LOWER - the build takes some time and with lower it works better with
foreground processes
WAIT - without wait the TOOL runs detached, it means that I cannot stop it
with Ctrl-C
In the same window (/B) - The TOOL is actually started from Eclipse and the
command prompt is in integrated window
TaskManager - no, this is not an option, I am not slave of my PC :-)
beyondlogic.org will not work, there will be more processes called
java.exe...
I know how to write a C/C++ tool that will do the task, but I think someone
already did it.
Thank you, Jan
Mark V 10-05-2006, 03:27 PM In microsoft.public.win2000.cmdprompt.admin jan_bar wrote:
> Thank you Mark and "billious", let me clarify:
>
> TOOL - Maven (command line Java project management framework)
> LOWER - the build takes some time and with lower it works
> better with foreground processes
> WAIT - without wait the TOOL runs detached, it means that I
> cannot stop it with Ctrl-C
> In the same window (/B) - The TOOL is actually started from
> Eclipse and the command prompt is in integrated window
>
> TaskManager - no, this is not an option, I am not slave of my PC
> :-)
>
> beyondlogic.org will not work, there will be more processes
> called java.exe...
>
> I know how to write a C/C++ tool that will do the task, but I
> think someone already did it.
More clear now. I am not familiar with the tools you use. Any
chance that just a
START "" /LOW CMD.EXE /C TOOL
will cut it? Assuming "other processes" invoked from TOOL ought to
inherit the Priority. But depends on how they are started from
TOOL of course. I may be way off the mark since I do not fully
comprehend the problem, so FWIW.
jan_bar 10-05-2006, 03:55 PM Thanks Mark
> More clear now. I am not familiar with the tools you use. Any
> chance that just a
> START "" /LOW CMD.EXE /C TOOL
> will cut it? Assuming "other processes" invoked from TOOL ought to
this is will open new console window. The TOOL must run in the *same*
window, see me previous post.
Thank you, Jan
billious 10-05-2006, 04:05 PM "jan_bar" <nospam@nospam.nospam> wrote in message
news:eh2g%234I6GHA.4304@TK2MSFTNGP03.phx.gbl...
> Thanks Mark
>
>> More clear now. I am not familiar with the tools you use. Any
>> chance that just a
>> START "" /LOW CMD.EXE /C TOOL
>> will cut it? Assuming "other processes" invoked from TOOL ought to
>
> this is will open new console window. The TOOL must run in the *same*
> window, see me previous post.
>
> Thank you, Jan
>
>
Since you seem to have ignored it, here's a way to do what I believe you
want. It's not elegant, but it'll work.
This can be achieved by the following, given Demo1.bat is on the desktop -
I've used EDIT since we're not aware of what TOOL is.
----- batch demo1 begins -------
[1]@echo off
[2]start "" /low /max demo2.bat
[3]exit
------ batch demo1 ends --------
----- batch demo2 begins -------
[1]edit junk.txt
[2]start "" /normal /max demo3.bat
[3]exit
------ batch demo2 ends --------
----- batch demo3 begins -------
[1]echo now in demo3!
[2]pause
[3]exit
------ batch demo3 ends --------
Lines start [number] - any lines not starting [number] have been wrapped
and should be rejoined. The [number] that starts the line should be removed
Mark V 10-05-2006, 04:17 PM In microsoft.public.win2000.cmdprompt.admin jan_bar wrote:
> Thanks Mark
>
>> More clear now. I am not familiar with the tools you use. Any
>> chance that just a
>> START "" /LOW CMD.EXE /C TOOL
>> will cut it? Assuming "other processes" invoked from TOOL
>> ought to
>
> this is will open new console window. The TOOL must run in the
> *same* window, see me previous post.
Ok, then I have nothing further useful.
But, Perhaps the original CMD can alter itself to a lower priority
first, then reset after TOOL et. al. returns? Just musing...
jan_bar 10-06-2006, 09:01 AM Thank you
>
> Since you seem to have ignored it, here's a way to do what I believe you
> want. It's not elegant, but it'll work.
I did not ignored it, but it doesn't solve my problem because it opens new
console windows.
Jan
billious 10-06-2006, 09:35 AM "jan_bar" <nospam@nospam.nospam> wrote in message
news:Oym7l2R6GHA.3384@TK2MSFTNGP05.phx.gbl...
> Thank you
>
>>
>> Since you seem to have ignored it, here's a way to do what I believe you
>> want. It's not elegant, but it'll work.
>
> I did not ignored it, but it doesn't solve my problem because it opens new
> console windows.
>
> Jan
>
>
Evidently you didn't TRY it. Only ONE console window is ever open. The fact
that it's a NEW window should be irrelevant.
jan_bar 10-06-2006, 01:36 PM Of course I did. There is only one console window but threee different
processes. As I already wrote, the console window will actual be part of IDE
application, so it must stay there. In fact the IDE doesn't create the
console window, it spawns new cmd process and redirects stdin, stdout and
stderror to self. The redirection will be ignored by new console.
Jan
> Evidently you didn't TRY it. Only ONE console window is ever open. The
fact
> that it's a NEW window should be irrelevant.
>
>
Todd Vargo 10-06-2006, 11:03 PM "jan_bar" <nospam@nospam.nospam> wrote in message
news:OE$Z8a85GHA.1248@TK2MSFTNGP03.phx.gbl...
> Hi,
>
> I want to start command line tool from a batch, keep the same command
window
> and wait for it at the same time. Sample:
>
> start "test" /low /wait /b "path\to\some\command\line\tool.exe"
>
> The problem is, that /wait and /b doesn't work together. When the /b is
> specified, the /wait is ignored - and any Ctrl-C will nto reach the
running
> tool.exe. How can I solve this?
> In fact, I just want to start the tool.exe with lower priority, start /low
> seems to be the cheapest way.
>
> Thanks, Jan
It appears the order of the switches in makes a difference. The following
command seems to wait for me (/wait switch last).
start /b /low /wait tool.exe
--
Todd Vargo
(Post questions to group only. Remove "z" to email personal messages)
--
Todd Vargo
(Post questions to group only. Remove "z" to email personal messages)
jan_bar 10-07-2006, 06:55 AM Thanks Todd
> It appears the order of the switches in makes a difference. The following
> command seems to wait for me (/wait switch last).
>
> start /b /low /wait tool.exe
yes, it works, thank you.
Here is my test batch, the TOOL is "ping -n 10 google.com"
test.bat:
@echo off
echo.
echo Start of ping
start "pinging" /b /wait /low ping -n 10 google.com
echo.
echo End of ping
|
|
|