image for windows batch file

Discussion in 'backup, imaging & disk mgmt' started by lodore, Oct 26, 2009.

Thread Status:
Not open for further replies.
  1. lodore

    lodore Registered Member

    Joined:
    Jun 22, 2006
    Posts:
    9,006
    Hello,
    for some reason when i run the batch file on windows 7 it tries to run imagewc.exe from Z:\IFW images instead of C:\IFWC
    it worked when i copied the image for windows command version files to Z:\IFW images

    im not sure what to change so that the images write to correct location and starts imagewc from C:\IFWC
    the batch file is as follows:

    if not defined RunTask set RunTask=1 & start "Image for Windows" /min %SystemRoot%\system32\cmd.exe /c "%0" & goto :EOF

    path=C:\Program Files (X86)\IFWC;%path%

    Z:
    CD \IFW images

    imagewc /b /uy /d:w0@0x1 /f:"C %%~DOW%%-%%~DD%%-%%~MM%%" /vb

    if not %errorlevel% == 0 (
    echo %date% %time% >> fail.log
    echo Imagew errorlevel is %errorlevel% >> fail.log
    echo. >> fail.log
    exit
    )
    exit
     
    Last edited: Oct 26, 2009
  2. Brian K

    Brian K Imaging Specialist

    Joined:
    Jan 28, 2005
    Posts:
    8,634
    Location:
    NSW, Australia
    lodore,

    ifw.log should be in Z:\IFW images
    Does it tell you which line is incorrect? If not, try this....

    if not defined RunTask set RunTask=1 & start "Image for Windows" /min %SystemRoot%\system32\cmd.exe /c "%0" & goto :EOF

    pause

    path=C:\Program Files (X86)\IFWC;%path%

    pause

    Z:
    CD \IFW images

    pause

    imagewc /b /uy /d:w0@0x1 /f:"C %%~DOW%%-%%~DD%%-%%~MM%%" /vb

    pause

    if not %errorlevel% == 0 (
    echo %date% %time% >> fail.log
    echo Imagew errorlevel is %errorlevel% >> fail.log
    echo. >> fail.log
    pause
    )
    pause

    You should be able to identify the incorrect line.
     
  3. lodore

    lodore Registered Member

    Joined:
    Jun 22, 2006
    Posts:
    9,006
    Hello BrianK,

    see screenshot attached.
     

    Attached Files:

  4. Brian K

    Brian K Imaging Specialist

    Joined:
    Jan 28, 2005
    Posts:
    8,634
    Location:
    NSW, Australia
    Check your path. You have two different entries...

    C:\IFWC (showing in your screenshot)

    C:\Program Files (X86)\IFWC
     
  5. lodore

    lodore Registered Member

    Joined:
    Jun 22, 2006
    Posts:
    9,006
    ok ive changed path to path=Z:\IFW images\Automated\IFWC\imagewc.exe

    screenshot should reflect that.

    anyideas now?
     
  6. Brian K

    Brian K Imaging Specialist

    Joined:
    Jan 28, 2005
    Posts:
    8,634
    Location:
    NSW, Australia
    Leave off the imagewc.exe. Make it Z:\IFW images\Automated\IFWC;%path%

    I had my batch file working in Win7 and made a few changes to resemble your one. Now mine doesn't work. I'll keep trying.

    In your original batch file, was imagewc.exe in

    C:\IFWC or

    C:\Program Files (X86)\IFWC
     
  7. lodore

    lodore Registered Member

    Joined:
    Jun 22, 2006
    Posts:
    9,006
    Thanks it works now.
     
  8. Brian K

    Brian K Imaging Specialist

    Joined:
    Jan 28, 2005
    Posts:
    8,634
    Location:
    NSW, Australia
    Good. Mine is fixed too. I'm not sure what error I made.
     
  9. lodore

    lodore Registered Member

    Joined:
    Jun 22, 2006
    Posts:
    9,006
    Is there a command which i can put in the batch file that deletes the oldest one when the partition runs out of space?
     
  10. Brian K

    Brian K Imaging Specialist

    Joined:
    Jan 28, 2005
    Posts:
    8,634
    Location:
    NSW, Australia
    Not that I know of.

    I know how to limit the number of backups. Say you only want 4 backups. After backup 5 has been created, the oldest backup is automatically deleted. Is that of use?
     
  11. lodore

    lodore Registered Member

    Joined:
    Jun 22, 2006
    Posts:
    9,006
    yup that would be useful.
     
  12. Brian K

    Brian K Imaging Specialist

    Joined:
    Jan 28, 2005
    Posts:
    8,634
    Location:
    NSW, Australia
    The final part of the batch file would be....

    if not %errorlevel% == 0 (
    echo %date% %time% >> fail.log
    echo imagewc errorlevel is %errorlevel% >> fail.log
    echo. >> fail.log
    exit
    )

    IF EXIST Windows_15.TBI (DEL Windows_15.TBI)
    IF EXIST Windows_14.TBI (REN Windows_14.TBI Windows_15.TBI)
    IF EXIST Windows_13.TBI (REN Windows_13.TBI Windows_14.TBI)
    IF EXIST Windows_12.TBI (REN Windows_12.TBI Windows_13.TBI)
    IF EXIST Windows_11.TBI (REN Windows_11.TBI Windows_12.TBI)
    IF EXIST Windows_10.TBI (REN Windows_10.TBI Windows_11.TBI)
    IF EXIST Windows_09.TBI (REN Windows_09.TBI Windows_10.TBI)
    IF EXIST Windows_08.TBI (REN Windows_08.TBI Windows_09.TBI)
    IF EXIST Windows_07.TBI (REN Windows_07.TBI Windows_08.TBI)
    IF EXIST Windows_06.TBI (REN Windows_06.TBI Windows_07.TBI)
    IF EXIST Windows_05.TBI (REN Windows_05.TBI Windows_06.TBI)
    IF EXIST Windows_04.TBI (REN Windows_04.TBI Windows_05.TBI)
    IF EXIST Windows_03.TBI (REN Windows_03.TBI Windows_04.TBI)
    IF EXIST Windows_02.TBI (REN Windows_02.TBI Windows_03.TBI)
    IF EXIST Windows_01.TBI (REN Windows_01.TBI Windows_02.TBI)
    REN Windows.TBI Windows_01.TBI
    exit


    You would have to make your command line...

    imagewc /b /uy /d:w0@0x1 /f:"Windows" /vb

    I've used Windows as an example filename. Windows_01.tbi is always the most recent backup. You can edit the above to make it save less copies than 15. Sorry, I don't know how to do it with the filename you prefer (C %%~DOW%%-%%~DD%%-%%~MM%%).
     
Loading...
Thread Status:
Not open for further replies.