locked
Create a backup up of your windows desktop using disk2vhd vhd RRS feed

  • General discussion

  • I want to use a script to run disk2vhd every other day to make a backup of my desktop windows 7 files.

    anyone has a good working script

    this is what i have and its not working

    @echo off

      for /f "Tokens=1-4 Delims=/ " %%i in ('date /t') do set dt=%%i-%%j-%%k-%%l
      for /f "Tokens=1" %%i in ('time /t') do set tm=-%%i
      set tm=%tm::=-%
      set dtt={%dt%(%tm%)}
      set LogFile="\\y:\vhd\%computernames%-%dt%-vhdlog.txt"
      set VHDFileName="\\y:\vhd\%computernames%-%dt%.VHD"
      set FolderToDisk2VHD=C:\Users\admin\Downloads\Disk2vhd

    echo Starting Disk2VHD at: %dtt% > %LogFile%

    "%FolderToDisk2VHD%\disk2vhd.exe" -accepteula c:, %VHDFileName% >> %LogFile% 2>&1

    Rem Pre-Cleanup
      set dt=
      set tm=
      set dtt=

      for /f "Tokens=1-4 Delims=/ " %%i in ('date /t') do set dt=%%i-%%j-%%k-%%l
      for /f "Tokens=1" %%i in ('time /t') do set tm=-%%i
      set tm=%tm::=-%
      set dtt={%dt%(%tm%)}

    echo Disk2VHD exited with an exit code of: %errorlevel% >> %LogFile%

    echo Finished Disk2VHD at: %dtt% >> %LogFile%

    Rem PostCleanup
      set LogFile=
      set VHDFileName=
      set FolderToDisk2VHD=
      set dt=
      set tm=
      set dtt=

    • Edited by Ernie Smith 2014 Wednesday, August 28, 2013 10:14 PM
    • Changed type Cloud_TS Thursday, September 5, 2013 12:17 PM redirection
    Wednesday, August 28, 2013 9:41 PM

All replies

  • Hi,

    For issue about script, we’d recommend you ask script forum for professional solution:

    http://social.technet.microsoft.com/Forums/scriptcenter/en-US/home

    The reason why we recommend posting appropriately is you will get the most qualified pool of respondents, and other partners who read the forums regularly can either share their knowledge or learn from your interaction with us. Thank you for your understanding.


    Karen Hu
    TechNet Community Support


    • Edited by Karen Hu Friday, August 30, 2013 6:44 AM update
    Thursday, August 29, 2013 6:40 AM