shutdown

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

hi, how can i shtudown my computer after a certain program program exits, for
examples i have this code

Dim withevents defrag as new process
Dim defragSI as new processstartinfo("C:\windows\system32\dfrag.msc")

then i have a "defrag has exited" event, so how can i have my computer
shutdown when this command executes?

thanks!
 
Hi,

http://www.mentalis.org/soft/class.qpx?id=7

Ken
---------------
hi, how can i shtudown my computer after a certain program program exits,
for
examples i have this code

Dim withevents defrag as new process
Dim defragSI as new processstartinfo("C:\windows\system32\dfrag.msc")

then i have a "defrag has exited" event, so how can i have my computer
shutdown when this command executes?

thanks!
 
iwdu15 said:
hi, how can i shtudown my computer after a certain program program exits,
for
examples i have this code

Dim withevents defrag as new process
Dim defragSI as new processstartinfo("C:\windows\system32\dfrag.msc")

then i have a "defrag has exited" event, so how can i have my computer
shutdown when this command executes?

In addition to Ken's reply:

\\\
Dim p As Process = Process.Start("C:\WINDOWS\SYSTEM32\defrag.msc")
p.WaitForExit()
ShutdownMachine()
///
 
ok thanks but the problem is, defrag doesnt exit when it is finished
defragging....how can i tell if it is done?
 
iwdu15 said:
ok thanks but the problem is, defrag doesnt exit when it is finished
defragging....how can i tell if it is done?

Maybe you can find a solution by starting "defrag.exe" instead of the
Management Console.
 
im doing that now, i switched to the defrag program and i can get to to
defrag, but i dont kno how to tell if its done or not
 
iwdu15 said:
im doing that now, i switched to the defrag program and i can get to to
defrag, but i dont kno how to tell if its done or not

Did you already try 'Process.WaitForExit' as shown in my sample?
 
i would but defrag doesnt exit once its done defragging, so it would just sit
there
 
hmm is this still about the auto defrag :-)

well i have some info , that might be of help

with these scripts found here you can do exactly what you want

http://www.compu-docs.com/W2KDfrag.htm

if you want to write it pure in VB that is no problem ,,, as you only have
to start the defrag service , give it the main focus , send the apropriate
keys , and read the window caption to see if it is finished the parameters
can be found in these scripts


regards

Michel Posseth [MCP]
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top