Jump to content

Welcome to Geeks to Go - Register now for FREE

Geeks To Go is a helpful hub, where thousands of volunteer geeks quickly serve friendly answers and support. Check out the forums and get free advice from the experts. Register now to gain access to all of our features, it's FREE and only takes one minute. Once registered and logged in, you will be able to create topics, post replies to existing threads, give reputation to your fellow members, get your own private messenger, post status updates, manage your profile and so much more.

Create Account How it Works
Photo

DOS Batch Scripting


  • Please log in to reply

#1
PC Genie

PC Genie

    Member

  • Member
  • PipPip
  • 88 posts
I have a DOS Batch Script to backup my Windows registry and I need to make some changes. Currently, it only saves the backup to one folder; but I need it to create a separate folder for each backup. The name of each folder should be different by using a date and time stamp. Is this possible?
  • 0

Advertisements


#2
SleepyDude

SleepyDude

    Trusted Helper

  • Malware Removal
  • 4,149 posts
Hi,

Can you post the batch file please?
I will say it could be possible but it depends on the way you use to backup the registry...
  • 0

#3
PC Genie

PC Genie

    Member

  • Topic Starter
  • Member
  • PipPip
  • 88 posts
Thanks for your reply. Here is the rough draft of my code.

@echo off
color 1f
@echo.

@echo Now Backing up the Registry.
@echo Please Stand by... 

set datetimestamp=%year%%month%%day%%hour%%minute%%second%

cd C:\Users\Public\RegistryBackup

regedit /e "registry-backup.reg"

cls
color 2f
@echo.
@echo Done!!!
@echo A copy of the Registry has been saved to the designated folder.
pause

Hi,

Can you post the batch file please?
I will say it could be possible but it depends on the way you use to backup the registry...


  • 0

#4
SleepyDude

SleepyDude

    Trusted Helper

  • Malware Removal
  • 4,149 posts
Hi,

Doing a Registry Backup like that isn't a very good backup because the regedit export can fail exporting certain keys or generate a .reg file with errors that make the import to fail.

If you want to have an 100% good registry backup I would recommend you the use of this free program Tweaking.com - Registry Backup

By default the program will create a backup in the folder you choose and every registry backup will be places on a folder with the date and time.

The program can by run automatically without any user input passing the switch /SILENT to the main exe file.

Hope this helps.
  • 0

#5
PC Genie

PC Genie

    Member

  • Topic Starter
  • Member
  • PipPip
  • 88 posts
That's great. It look like it backs up much more than the registry, so probably that's best. Thanks very much.

I'm still curious, though, about creating a folder with a date stamp. This could come in handy in the future for some other uses that I have. Since we're on the subject of DOS Batch Scripts, could you show me how to do that? Thanks.
  • 0

#6
SleepyDude

SleepyDude

    Trusted Helper

  • Malware Removal
  • 4,149 posts
Hi,

Ok I will show you an example that you should be able to adapt to your needs...

@echo off
setlocal
echo Date: %date%
echo Time: %time%
echo.

:: cut time to only HH:MM:SS
set _TIME=%time:~0,8%
:: replace ':' by '_' because ':' isn't valid in file/folder names
set _TIME=%_TIME::=_%

echo %date%

echo %_TIME%

  • 0






Similar Topics

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users

As Featured On:

Microsoft Yahoo BBC MSN PC Magazine Washington Post HP