Groups > Microsoft > Windows PowerShell > Re: 'runwait' equivalent




'runwait' equivalent

'runwait' equivalent
Wed, 9 Apr 2008 12:51:00 -0700
I'm not sure if this question has been asked but searching returned nothing.  
Is there an easy way to wait until a process is complete when invoking native 
commands?

What I'm doing is writing a script to measure the time it takes to map a 
printer using con2prt.exe.  Each line is asynchrynously executed so obviously 
the measurements by measure-command are incorrect.

Post Reply
RE: 'runwait' equivalent
Wed, 9 Apr 2008 12:59:00 -0700
Okay, so looking down 6 lines, I see that someone asked about running 
external commands.  Sorry, I guess I just suck at searching also :-(.  

I'll use the Diagnostics.Proces objects as indicated in that thread for my 
purpose but can anyone tell me if this will add unecessary time to my 
measurements?



"Cookiecutter" wrote:

> I'm not sure if this question has been asked but searching returned
nothing.  
> Is there an easy way to wait until a process is complete when invoking
native 
> commands?
> 
> What I'm doing is writing a script to measure the time it takes to map a 
> printer using con2prt.exe.  Each line is asynchrynously executed so
obviously 
> the measurements by measure-command are incorrect.
> 
Post Reply
Re: 'runwait' equivalent
Wed, 9 Apr 2008 13:38:00 -0700
Wow, it IS really that simple.  Thank you kind sir.

"Keith Hill [MVP]" wrote:

> "Cookiecutter" <Cookiecutter@discussions.microsoft.com>
wrote in message 
> news:96C337E8-A68D-42B7-B500-C31323F97150@microsoft.com...
> > Okay, so looking down 6 lines, I see that someone asked about running
> > external commands.  Sorry, I guess I just suck at searching also :-(.
> >
> > I'll use the Diagnostics.Proces objects as indicated in that thread
for my
> > purpose but can anyone tell me if this will add unecessary time to my
> > measurements?
> >
> 
> Another way is to just pipe the output to out-null e.g.:
> 
> PS> notepad | out-null
> 
> --
> Keith 
Post Reply
Re: 'runwait' equivalent
Wed, 9 Apr 2008 14:28:54 -0600
"Cookiecutter" <Cookiecutter@discussions.microsoft.com> wrote in
message 
news:96C337E8-A68D-42B7-B500-C31323F97150@microsoft.com...
> Okay, so looking down 6 lines, I see that someone asked about running
> external commands.  Sorry, I guess I just suck at searching also :-(.
>
> I'll use the Diagnostics.Proces objects as indicated in that thread for my
> purpose but can anyone tell me if this will add unecessary time to my
> measurements?
>

Another way is to just pipe the output to out-null e.g.:

PS> notepad | out-null

--
Keith 
Post Reply
Re: 'runwait' equivalent
Wed, 9 Apr 2008 19:34:00 -0700
How about this?

$backup_process = get-process ntbackup
$backup_process.waitforexit()
-- 
Rob Pettrey
Microsoft Small Business Specialist


"Cookiecutter" wrote:

> Wow, it IS really that simple.  Thank you kind sir.
> 
> "Keith Hill [MVP]" wrote:
> 
> > "Cookiecutter"
<Cookiecutter@discussions.microsoft.com> wrote in message 
> > news:96C337E8-A68D-42B7-B500-C31323F97150@microsoft.com...
> > > Okay, so looking down 6 lines, I see that someone asked about
running
> > > external commands.  Sorry, I guess I just suck at searching also
:-(.
> > >
> > > I'll use the Diagnostics.Proces objects as indicated in that
thread for my
> > > purpose but can anyone tell me if this will add unecessary time
to my
> > > measurements?
> > >
> > 
> > Another way is to just pipe the output to out-null e.g.:
> > 
> > PS> notepad | out-null
> > 
> > --
> > Keith 
Post Reply
about | contact