Command line image backup

blockie

New member
Member
VIP
Local time
3:34 PM
Messages
605
Location
in Assisted Care facility, Calif
I have looked for but cannot find a command line that I can put in a bat file and use the Windows 7 scheduler to accomplish image backups on a schedule.
 

My Computer

Computer type
Laptop
Computer Manufacturer/Model Number
Asus
OS
W7 Ultimate
CPU
2.2 bh Intel Core i3-2330M
Motherboard
Asustek Computer Inc. P53E 1.0
Memory
4MB
Graphics Card(s)
On Board
Sound Card
On Board
Monitor(s) Displays
On Board
Screen Resolution
1366 X 768
Hard Drives
ST9500423AS
ST2000DM USB Backup Drive External
Do you mean, to use Windows Backup? or another program.

Here is some info on Task Sched command line

On that page you will find the following.....


To copy all files from the Documents folder to the MyDocs folder at midnight, type the following line, and then press ENTER:




at 00:00 cmd /c copy C:\Documents\*.* C:\MyDocs
  • To back up the Products server at 11:00 P.M. each weekday, create a batch file that contains the backup commands (for example, Backup.bat), type the following line, and then press ENTER to schedule the backup:
at \\products 23:00 /every:M,T,W,Th,F backup
  • To schedule a net share command to run on the Sales server at 6:00 A.M. and to redirect the listing to the Sales.txt file in the shared Reports folder on the Corp server, type the following line, and then press ENTER:
at \\sales 06:00 cmd /c "net share reports=d:\Documents\reports >> \corp\reports\sales.txt"


You know, I hadn't tested what I posted,, just assumed it would work.
And yes, it does infact work, as well as what SIW2 posted below.

Here is the info on SCHTASKS
 

My Computer

Computer Manufacturer/Model Number
Self Built
OS
Win 7 Ultimate 32bit
CPU
C2D E6600 2.4Ghz
Motherboard
Intel D965WH
Memory
4G Kingston KHX5400D2
Graphics Card(s)
EVGA GTX 570 HD SC (012-P3-1573-KR)
Sound Card
On-Board
Monitor(s) Displays
Samsung 226BW
Screen Resolution
1680 x 1050
Hard Drives
2 x 250 Seagate Barracuda
2 x 500 Seagate Barracuda (Raid1)
PSU
Corsair TX750W
Case
In-Win C589
Cooling
Stock Intel Cooling
SCHTASKS /Create /SC DAILY /TN <TaskName> /RL HIGHEST /ST <StartTime> /TR <Wbadmin Command>

e.g.

SCHTASKS /Create /SC DAILY /TN MyDailyBackup /RL HIGHEST /ST 09:00 /TR "WBADMIN START BACKUP -backupTarget:J: -include:D: -quiet >> C:\mydailybackupLog.txt"


Or weekly:

SCHTASKS /Create /SC WEEKLY /D <Day Of Week> /TN <TaskName> /RL HIGHEST /ST <StartTime> /TR <Wbadmin Command>
 

My Computers

System One System Two

  • Computer type
    PC/Desktop
    OS
    7 X64
    CPU
    i5 8400
    Motherboard
    gigabyte b365m ds3h
    Memory
    2x8gb 3200mhz
    Hard Drives
    various
    PSU
    pure power 11 400w cm
    Case
    Coolermaster
    Cooling
    cryorig m9i
  • Computer type
    PC/Desktop
    OS
    7x64
    CPU
    g5400
    Motherboard
    ga b365m ds3h
    Memory
    8gb ddr4 2400
    PSU
    xfx pro 450w
Tepid,
I would use the Windows 7 Image backup.
I wish to create a batch file. This is the info I need.
I will use then use the Windows 7 Task Scheduler to run the batch file at the appropriate time.

Thanks to SIW2 for your input. Not ready to take on the SCHTASKS thing yet. A simple batch file is what I am familiar with.
 

My Computer

Computer type
Laptop
Computer Manufacturer/Model Number
Asus
OS
W7 Ultimate
CPU
2.2 bh Intel Core i3-2330M
Motherboard
Asustek Computer Inc. P53E 1.0
Memory
4MB
Graphics Card(s)
On Board
Sound Card
On Board
Monitor(s) Displays
On Board
Screen Resolution
1366 X 768
Hard Drives
ST9500423AS
ST2000DM USB Backup Drive External

My Computer

Computer type
PC/Desktop
Computer Manufacturer/Model Number
Self built custom
OS
64-bit Windows 11 Pro for Workstations
CPU
Intel i7-8700K OC'd to 5 GHz
Motherboard
ASUS ROG Maximus XI Formula Z390
Memory
64 GB (4x16GB) G.SKILL TridentZ RGB DDR4 3600 MHz
Graphics Card(s)
ASUS ROG-STRIX-GTX1080TI-O11G-GAMING
Sound Card
Integrated
Monitor(s) Displays
2 x Samsung Odyssey G7 27"
Screen Resolution
2560x1440
Hard Drives
1TB Samsung 990 PRO M.2,
4TB Samsung 990 PRO PRO M.2,
TerraMaster F8 SSD Plus NAS
PSU
Seasonic Prime Titanium 850W
Case
Thermaltake Core P3
Cooling
Corsair Hydro H115i
Keyboard
Logitech wireless K800
Mouse
Logitech MX Master 4
Internet Speed
2 Gb/s Download and 100 Mb/s Upload
Antivirus
Malwarebyte Anti-Malware Premium
Browser
Google Chrome
Other Info
Logitech Z625 speaker system,
Logitech BRIO 4K Pro webcam,
HP Color LaserJet Pro MFP M477fdn,
APC SMART-UPS RT 1000 XL - SURT1000XLI,
Galaxy S23 Plus phone
Shawn,
It looks like W7 has everything.However, I do not wish to backup the libraries, Just an image. I would like to make as many images as my 300GB disk will hold, deleting the oldest when necessary. I can use the disk management tools to make an image a VHD and attach it. That way I can always explore it and copy and paste if necessary. Better than library BU's in my estimator.
 

My Computer

Computer type
Laptop
Computer Manufacturer/Model Number
Asus
OS
W7 Ultimate
CPU
2.2 bh Intel Core i3-2330M
Motherboard
Asustek Computer Inc. P53E 1.0
Memory
4MB
Graphics Card(s)
On Board
Sound Card
On Board
Monitor(s) Displays
On Board
Screen Resolution
1366 X 768
Hard Drives
ST9500423AS
ST2000DM USB Backup Drive External
Why don't you make your life easy and use free Macrium for imaging. No hoops to jump like with the Win7 facility. Very easy to setup and schedule. See my video tutorial with a link to a short written introduction. I have done many restores with it and it works flawlessly.

Here is how I image my systems - but you need not go to such an extreme:

I make a daily image of my system and data partitions at boot-up. I have set Macrium to do that automatically. It takes only 9 minutes from my SSD to the internal HDD. Every Sunday, I copy the Sunday image to an on-line external disk into a "weekly folder". Every first of the month I also copy the last image to an external disk "monthly folder" that usually stays off-line. That way I have a whole history all the way back to the initial installation.
 

My Computer

Computer Manufacturer/Model Number
HP, Dell, Gateway, Toshiba - 4 laptops and 2 desktops
OS
Vista, Windows7, Mint Mate, Zorin, Windows 8
CPU
from 1.6GHz Duo to i7
Monitor(s) Displays
2x HP w2207
Hard Drives
5x HDD, 7x SSD, 12x Externals
Keyboard
with trackball - no mices
Mouse
Trackball mice
Internet Speed
DSL 6000
Blockie,

You can use the "Wbadmin" command to backup win7 from the command line. This the command reference page from MS.

Wbadmin

But just google for "win7 wbadmin" and there are pages and pages of results.
 

My Computer

Computer Manufacturer/Model Number
Too many to describe...
OS
Windows 7 x64 pro/ Windows 7 x86 Pro/ XP SP3 x86
If I understand all the help provided the BADMIN command only does backups of variouis folders or files. What I am asking is for a command line IMAGE, I say again, IMAGE backup. A simple batch file will do and then I will use the scheduler to execute it. I do not want to do a simple backup of various files and folders.
 

My Computer

Computer type
Laptop
Computer Manufacturer/Model Number
Asus
OS
W7 Ultimate
CPU
2.2 bh Intel Core i3-2330M
Motherboard
Asustek Computer Inc. P53E 1.0
Memory
4MB
Graphics Card(s)
On Board
Sound Card
On Board
Monitor(s) Displays
On Board
Screen Resolution
1366 X 768
Hard Drives
ST9500423AS
ST2000DM USB Backup Drive External
Not sure where you got that idea, Blockie.

It makes an image when i run it, eg

"WBADMIN START BACKUP -backupTarget:J: -include:D: -quiet >> C:\mydailybackupLog.txt"

makes an image of D volume and stores it on J.

if you want to include more volumes, separate them with colons, like this:

WBADMIN START BACKUP -backupTarget:J: -include:C:D:E: -quiet

This bit >> C:\mydailybackupLog.txt is optional , to output a log to a textfile.

I agree with whs - 3rd party apps. are easier to use and more flexible, even the free versions.
 

My Computers

System One System Two

  • Computer type
    PC/Desktop
    OS
    7 X64
    CPU
    i5 8400
    Motherboard
    gigabyte b365m ds3h
    Memory
    2x8gb 3200mhz
    Hard Drives
    various
    PSU
    pure power 11 400w cm
    Case
    Coolermaster
    Cooling
    cryorig m9i
  • Computer type
    PC/Desktop
    OS
    7x64
    CPU
    g5400
    Motherboard
    ga b365m ds3h
    Memory
    8gb ddr4 2400
    PSU
    xfx pro 450w
But not all 3rd party apps provide a command line, or a decent command line structure.
 

My Computer

Computer Manufacturer/Model Number
Self Built
OS
Win 7 Ultimate 32bit
CPU
C2D E6600 2.4Ghz
Motherboard
Intel D965WH
Memory
4G Kingston KHX5400D2
Graphics Card(s)
EVGA GTX 570 HD SC (012-P3-1573-KR)
Sound Card
On-Board
Monitor(s) Displays
Samsung 226BW
Screen Resolution
1680 x 1050
Hard Drives
2 x 250 Seagate Barracuda
2 x 500 Seagate Barracuda (Raid1)
PSU
Corsair TX750W
Case
In-Win C589
Cooling
Stock Intel Cooling
Sorry,
Looking at the examples heretofore provided I got that idea. In a little while I will test this on my system. Thanks.
 

My Computer

Computer type
Laptop
Computer Manufacturer/Model Number
Asus
OS
W7 Ultimate
CPU
2.2 bh Intel Core i3-2330M
Motherboard
Asustek Computer Inc. P53E 1.0
Memory
4MB
Graphics Card(s)
On Board
Sound Card
On Board
Monitor(s) Displays
On Board
Screen Resolution
1366 X 768
Hard Drives
ST9500423AS
ST2000DM USB Backup Drive External
"WBADMIN START BACKUP -backupTarget:D: -include:C: -quiet >> C:\mydailybackupLog.txt"

The above command line not do anything except open the dos window and display. The only change I made to yours was destination D and to backup C and remove the quotes.
 
Last edited:

My Computer

Computer type
Laptop
Computer Manufacturer/Model Number
Asus
OS
W7 Ultimate
CPU
2.2 bh Intel Core i3-2330M
Motherboard
Asustek Computer Inc. P53E 1.0
Memory
4MB
Graphics Card(s)
On Board
Sound Card
On Board
Monitor(s) Displays
On Board
Screen Resolution
1366 X 768
Hard Drives
ST9500423AS
ST2000DM USB Backup Drive External
Did you use an admin command prompt? (Rt click cmd.exe and run as admin)

If there isn't enough space on the target , you will get this in the log file C:\mydailybackupLog.txt

wbadmin 1.0 - Backup command-line tool
(C) Copyright 2004 Microsoft Corp.

Retrieving volume information...
This will back up volume Vista x86(C:) to D:.
There is not enough free space on the backup storage location to back up the data.
 

My Computers

System One System Two

  • Computer type
    PC/Desktop
    OS
    7 X64
    CPU
    i5 8400
    Motherboard
    gigabyte b365m ds3h
    Memory
    2x8gb 3200mhz
    Hard Drives
    various
    PSU
    pure power 11 400w cm
    Case
    Coolermaster
    Cooling
    cryorig m9i
  • Computer type
    PC/Desktop
    OS
    7x64
    CPU
    g5400
    Motherboard
    ga b365m ds3h
    Memory
    8gb ddr4 2400
    PSU
    xfx pro 450w
You need to run Wbadmin commands in elevated cmd.

Right click on cmd, select "Run as Admin", then type your commands.
 

My Computer

Computer Manufacturer/Model Number
Too many to describe...
OS
Windows 7 x64 pro/ Windows 7 x86 Pro/ XP SP3 x86
I just did a backup and restore - it worked ok , but it's not quick, the image takes a lot of space, and care needs to be taken restoring from the command prompt.

Unless you are using Server 2008 it really is much easier quicker and safer to use a free 3rd party app.
 

My Computers

System One System Two

  • Computer type
    PC/Desktop
    OS
    7 X64
    CPU
    i5 8400
    Motherboard
    gigabyte b365m ds3h
    Memory
    2x8gb 3200mhz
    Hard Drives
    various
    PSU
    pure power 11 400w cm
    Case
    Coolermaster
    Cooling
    cryorig m9i
  • Computer type
    PC/Desktop
    OS
    7x64
    CPU
    g5400
    Motherboard
    ga b365m ds3h
    Memory
    8gb ddr4 2400
    PSU
    xfx pro 450w
Still didn't work even with elevated command prompt. I think I will look into a third party program.
 

My Computer

Computer type
Laptop
Computer Manufacturer/Model Number
Asus
OS
W7 Ultimate
CPU
2.2 bh Intel Core i3-2330M
Motherboard
Asustek Computer Inc. P53E 1.0
Memory
4MB
Graphics Card(s)
On Board
Sound Card
On Board
Monitor(s) Displays
On Board
Screen Resolution
1366 X 768
Hard Drives
ST9500423AS
ST2000DM USB Backup Drive External

My Computer

Computer type
PC/Desktop
Computer Manufacturer/Model Number
Self Built
OS
Win 10 Pro x64
CPU
Intel I5-2500K @3.3GHz
Motherboard
Asrock P67 Extreme4
Memory
16GB G.Skill Ripjaws X (4x4GB)
Graphics Card(s)
EVGA GeForce 750 Ti SC 2GB
Sound Card
ASUS Xonar DG 5.1 Channels 24-bit 96KHz PCI Interface Sound
Monitor(s) Displays
auria eq2367
Screen Resolution
1920 x 1080
Hard Drives
250GB Samsung 850 EVO SSD
1TB WD Blue
1TB Hitachi
PSU
SeaSonic X 650W 80 Plus Gold
Case
Corsair Obsidian 750D
Cooling
Corsair H60, Three 140mm case fans
Keyboard
Logitech Wireless Keyboard K520
Mouse
Logitech Wireless Mouse M310
Internet Speed
Wave Broadband ~ 100 dn 5 up
Antivirus
Windows Defender, Malwarebytes Premium
Browser
Edge, IE11, Chrome
Other Info
Laptop specs: HP g7-1365dx /
CPU: AMD A6-3420M APU with Radeon(tm) HD Graphics /
RAM: Crucial 8Gb (2x4Gb) /
SSD: Crucial M4-CT128M4SSD2 ATA Device/ FW 000F /
GFX: AMD Radeon HD 6520G /
OS: Windows 10 Pro x64
The following batch file worked from a elevated command window:

"WBADMIN START BACKUP -backupTarget:D: -include:c: -quiet "

However, if I add a folder to back up to, like :

"WBADMIN START BACKUP -backupTarget:D:\Images\ -include:c: "-quiet

I get an error msg that the destination path cannot be found. What am I doing wrong? The folder D:\Images does, in fact, exist.

Can't get rid of the smiley face. It should be colon D
 
Last edited:

My Computer

Computer type
Laptop
Computer Manufacturer/Model Number
Asus
OS
W7 Ultimate
CPU
2.2 bh Intel Core i3-2330M
Motherboard
Asustek Computer Inc. P53E 1.0
Memory
4MB
Graphics Card(s)
On Board
Sound Card
On Board
Monitor(s) Displays
On Board
Screen Resolution
1366 X 768
Hard Drives
ST9500423AS
ST2000DM USB Backup Drive External
have you tried removing the last \

Code:
backupTarget:D:\Images
 

My Computer

Computer Manufacturer/Model Number
Self Built
OS
Win 7 Ultimate 32bit
CPU
C2D E6600 2.4Ghz
Motherboard
Intel D965WH
Memory
4G Kingston KHX5400D2
Graphics Card(s)
EVGA GTX 570 HD SC (012-P3-1573-KR)
Sound Card
On-Board
Monitor(s) Displays
Samsung 226BW
Screen Resolution
1680 x 1050
Hard Drives
2 x 250 Seagate Barracuda
2 x 500 Seagate Barracuda (Raid1)
PSU
Corsair TX750W
Case
In-Win C589
Cooling
Stock Intel Cooling
Back
Top