Jump to content

Welcome to Geeks to Go - Register now for FREE

Need help with your computer or device? Want to learn new tech skills? You're in the right place!
Geeks to Go is a friendly community of tech experts who can solve any problem you have. Just create a free account and post your question. Our volunteers will reply quickly and guide you through the steps. Don't let tech troubles stop you. Join Geeks to Go now and get the support you need!

How it Works Create Account
Photo

DOS Batch Scripting


  • Please log in to reply

#1
PC Genie

PC Genie

    Member

  • Member
  • PipPip
  • 93 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,976 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
  • 93 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,976 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
  • 93 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,976 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