Vista Forums
Vista Forums Home Join Vista Forums Donate Vista Tutorials Store Tags

Welcome to Vista Forums we are your forum to discuss Windows Vista x64 and x86 systems.

Go Back   Vista Forums > Vista technology newsgroups > PowerShell

'runwait' equivalent

Reply
 
Thread Tools Display Modes
Old 04-09-2008   #1 (permalink)
Cookiecutter
Guest
 
Posts: n/a

'runwait' equivalent

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.

Thanks in advance.
  Reply With Quote

Old 04-09-2008   #2 (permalink)
Cookiecutter
Guest
 
Posts: n/a

RE: 'runwait' equivalent

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:
Quote:

> 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.
>
> Thanks in advance.
  Reply With Quote
Old 04-09-2008   #3 (permalink)
Keith Hill [MVP]
Guest
 
Posts: n/a

Re: 'runwait' equivalent

"Cookiecutter" <Cookiecutter@xxxxxx> wrote in message
news:96C337E8-A68D-42B7-B500-C31323F97150@xxxxxx
Quote:

> 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

  Reply With Quote
Old 04-09-2008   #4 (permalink)
Cookiecutter
Guest
 
Posts: n/a

Re: 'runwait' equivalent

Wow, it IS really that simple. Thank you kind sir.

"Keith Hill [MVP]" wrote:
Quote:

> "Cookiecutter" <Cookiecutter@xxxxxx> wrote in message
> news:96C337E8-A68D-42B7-B500-C31323F97150@xxxxxx
Quote:

> > 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
>
  Reply With Quote
Old 04-09-2008   #5 (permalink)
Rob Pettrey
Guest
 
Posts: n/a

Re: 'runwait' equivalent

How about this?

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


"Cookiecutter" wrote:
Quote:

> Wow, it IS really that simple. Thank you kind sir.
>
> "Keith Hill [MVP]" wrote:
>
Quote:

> > "Cookiecutter" <Cookiecutter@xxxxxx> wrote in message
> > news:96C337E8-A68D-42B7-B500-C31323F97150@xxxxxx
Quote:

> > > 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
> >
  Reply With Quote
 
Reply

Thread Tools
Display Modes









Vistax64.com is an independent web site and has not been authorized,
sponsored, or otherwise approved by Microsoft Corporation.
"Windows Vista", the Start Orb, and related materials are trademarks of Microsoft Corp.
© Designer Media 2005-2008

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48