Thanks very much for your kind reply,here is the codes @echo off set version=Beta1 set imagefile=test.GHO Z:\gdisk 2 /del /all Z:\gdisk 2 /cre /pri Z:\gdisk 1 /del /all Z:\gdisk 1 /cre /pri Z:\ghost -clone,mode=PLOAD,src=Z:\%imagefile%:1,dst=1:1 -ntil -auto -sure -fx -PREFGHST -FFX -FFI -FFS SET E= FOR %%! IN (1 2) DO IF ERRORLEVEL %%!00 SET E=%%! SET !=0 1 2 3 4 5 6 7 8 9 IF ERRORLEVEL ?SET !=0 1 2 3 4 5 IF ERRORLEVEL : FOR %%! IN (%!%) DO IF ERRORLEVEL %E%%%!0 SET E=%E%%%! IF NOT ERRORLEVEL * SET !=0 1 2 3 4 5 6 7 8 9 FOR %%! IN (%!%) DO IF ERRORLEVEL %E%%%! SET E=%E%%%! IF NOT %E%==0 goto ERROR Z:\ghost -clone,mode=PLOAD,src=Z:\%imagefile%:2,dst=2:1 -ntil -auto -sure -fx -PREFGHST -FFX -FFI -FFS rem -fnu -fna SET E= FOR %%! IN (1 2) DO IF ERRORLEVEL %%!00 SET E=%%! SET !=0 1 2 3 4 5 6 7 8 9 IF ERRORLEVEL ?SET !=0 1 2 3 4 5 IF ERRORLEVEL : FOR %%! IN (%!%) DO IF ERRORLEVEL %E%%%!0 SET E=%E%%%! IF NOT ERRORLEVEL * SET !=0 1 2 3 4 5 6 7 8 9 FOR %%! IN (%!%) DO IF ERRORLEVEL %E%%%! SET E=%E%%%! IF NOT %E%==0 goto ERROR goto END :ERROR echo. echo The Ghosting process has failed!!! goto QUIT :END :QUIT That's the entire code,it is working for machines with 2 harddisks. When ghosting process is interrupted by Ctrl+C or other methods, the codes can detect this ,and turn to :error label.