Photo Gallery Member List Search Calendars FAQ Ticket List Log Out


A little help please.

 
Logged in as: Guest
arrSession:exec spGetSession 2,2,48884
 Active Users: There are 0 members and 0 guests.
 Users viewing this topic: none
 

 

 
  
  Printable Version
All Forums >> [Scripting] >> WSH & Client Side VBScript >> A little help please.
  Do you like VisualBasicScript.com? Link to us and help spread the word about our forum. Thanks!
Page: [1]
Login
Message << Older Topic   Newer Topic >>
 A little help please. - 6/29/2007 12:02:54 AM   
  doctortt

 

Posts: 73
Score: 0
Joined: 6/15/2007
Status: offline
Hi Guys. I need some help. Here is part of my script.  What can I do to replace c:\backup.reg in the line below with strFolderName\backup.reg?
So it actually creates the backup.reg under H:\abcbackup\<date>\backup.reg? Thanks.


strFolderName = "H:\abcBkup\" & strMonth & "-" & strDay & "-" & StrYear
strCommand = "regedit /e c:\backup.reg HKEY_LOCAL_MACHINE\Software\ActiveTouch"
 
 
Post #: 1
 
 RE: A little help please. - 6/29/2007 12:18:35 AM   
  mbouchard


Posts: 1916
Score: 16
Joined: 5/15/2003
From: USA
Status: offline
Take a look at Replace in the Wsh Documents.

_____________________________

Mike

For useful Scripting links see the Read Me First stickey!

Always remember Search is your friend.

(in reply to doctortt)
 
 
Post #: 2
 
 RE: A little help please. - 6/29/2007 12:29:40 AM   
  doctortt

 

Posts: 73
Score: 0
Joined: 6/15/2007
Status: offline
i'm a bit new to this. Can you please provide me a bit more hint, so I can poke around? Thanks.

(in reply to mbouchard)
 
 
Post #: 3
 
 RE: A little help please. - 6/29/2007 12:49:56 AM   
  mcds99


Posts: 434
Score: 4
Joined: 2/28/2006
Status: online
So you want to be able to redirect where the backup.reg file is put?


aPath = "H:\abcbackup\"
aDate = date

strCommand = "re4gedit /e " & aPath & aDate & "\ backup.reg HKEY_LOCAL_MACHINE\Software\ActiveTouch"

Look at the filesystem object to create the folder for the <date> I assume you want a new folder for each day or something like that.

_____________________________

Sam

Keep it Simple Make it Fun KiSMiF

(in reply to doctortt)
 
 
Post #: 4
 
 RE: A little help please. - 6/29/2007 1:09:01 AM   
  doctortt

 

Posts: 73
Score: 0
Joined: 6/15/2007
Status: offline
Here is the script. I just can't get the back up registry part working. Please take a look at the bold lines.   Again, I'm new to this.  Any help will be appreciated. Thanks.

Option Explicit
'On Error Resume Next
Dim objFSO, objFolder, strFolderName, WshShell, LavaRegistry
Dim StrMonth, StrDay, StrYear, RootFolder, StrCommand, strDate, strDelMax
Dim retDate, subfolder, Folder
RootFolder = "H:\LavaBkup"
Set WshShell = WScript.CreateObject("WScript.Shell")
Set objFSO = CreateObject("Scripting.FileSystemObject")
strDate = Now
strDelMax = 30
StrMonth = Month(Date)
StrDay = Day(Date)
StrYear = Year(Date)
strFolderName = "H:\LavaBkup\" & strMonth & "-" & strDay & "-" & StrYear
strCommand = "regedit /e" & strFolderName & "\ backup.reg HKEY_LOCAL_MACHINE\Software\ActiveTouch"

'================================================
If Len(strMonth) = 1 Then
strMonth = "0" & strMonth
End If
If Len(strDay) = 1 Then
strDay = "0" & strDay
End If
'================================================
If Not (objFSO.FolderExists(RootFolder)) Then
   objFSO.CreateFolder(RootFolder)
End if
If Not (objFSO.FolderExists(strFolderName)) Then
   objFSO.CreateFolder(strFolderName)
End if
'================================================
WshShell.Run(strCommand)
'================================================
Set Folder = objFSO.Getfolder(RootFolder)
For each subfolder in Folder.subfolders
RetDate = datediff("d",subfolder.datelastmodified,strDate)
    If retDate > strDelMax then
objFSO.Deletefolder(subfolder.Path)
    End if
Next
'================================================

(in reply to mcds99)
 
 
Post #: 5
 
 RE: A little help please. - 6/29/2007 1:35:22 AM   
  doctortt

 

Posts: 73
Score: 0
Joined: 6/15/2007
Status: offline
Thanks anyway guys. I fixed it. Just a few space issues.

strFolderName = "H:\LavaBkup\" & strMonth & "-" & strDay & "-" & StrYear
strCommand = "regedit /e " & strFolderName & "\backup.reg HKEY_LOCAL_MACHINE\Software\ActiveTouch"

(in reply to doctortt)
 
 
Post #: 6
 
 
 
  

If you found our site useful please link to us <a href="http://www.visualbasicscript.com">VisualBasicScript.com</a>.
All Forums >> [Scripting] >> WSH & Client Side VBScript >> A little help please. Page: [1]
Jump to:





New Messages No New Messages
Hot Topic w/ New Messages Hot Topic w/o New Messages
Locked w/ New Messages Locked w/o New Messages
 Post New Thread
 Reply to Message
 Post New Poll
 Submit Vote
 Delete My Own Post
 Delete My Own Thread
 Rate Posts