Quantcast
Channel: AutoIt v3 - General Help and Support
Viewing all articles
Browse latest Browse all 12506

Program stopping midway through execution

$
0
0

Hello everyone, I am making a script that opens the command prompt and starts a program, (Disk2VHD). Making a backup of my hard drive . then compresses the file after completing using 7zip.

I have tested each part of the script, and each part works individually, but when I put them all together the program hangs up after closing Disk2VHD. I am open to any advice, and would be grateful for any help in solving this issue. 

 

Thanks,

Ryan

 

 

 

 

 
 
Run("cmd.exe") ; opens command prompt
   WinWaitActive("Administrator: C:\Windows\system32\cmd.exe") ;wait for command prompt to become active window
 Sleep (2000) ; wait before sending text to command prompt
Send("cd c:\""program files (x86)""\disk2vhd &&  start disk2vhd.exe c: c:\VHD\Backup.vhd{ENTER}") ;start disk2vhd making a copy of C: drive and store it in the VHD subfolder
WinSetState ( "Administrator: C:\Windows\system32\cmd.exe", "" , @SW_HIDE ) ;hide command prompt while Disk2VHD is working
WinWaitActive("Disk2vhd - Sysinternals: www.sysinternals.com", "Disk export to VHD completed successfully.") ;wait for Disk2VHD to finish making VHD
 
Sleep(2000) ;wait after Disk2VHD has finished fully before closing
   ProcessClose("disk2vhd.exe") ;end disk2vhd process
   ProcessClose("disk2vhd-tmp.exe") ;close disk2vhd
Sleep(1000) ;wait after closing disk2vhd
 
WinSetState("Administrator: C:\Windows\system32\cmd.exe", "" , @SW_SHOW) ;show command prompt
   WinActivate("Administrator: C:\Windows\system32\cmd.exe") ;make command prompt the active window
 WinWaitActive("Administrator: C:\Windows\system32\cmd.exe") ;wait until command prompt is the active window
Send("cd c:\""program files (x86)""\7-zip && 7z a c:\vhd\backup.zip c:\vhd\backup.VHD && exit {enter}") ;compress the vhd file using 7zip in the VHD subfolder
   
Exit ; end the script
   

 


Viewing all articles
Browse latest Browse all 12506

Trending Articles