Another question apart from the one in the last box is:
Can i get the backup script to look for the default TEMP folder from the windows System Variable and copy the files in there under winteg e.g. so it doesnt matter which temp they use. And then i would like to copy the saved into the new c:\winteg\kcs\session605 folders:
Sctipt 1 - checks for C:\temp then creates it
-----------------
Option Explicit
Dim objFSO, objFolder, objShell, strDirectory
strDirectory = "c:\tempkcs"
' Create the File System Object
Set objFSO = CreateObject("Scripting.FileSystemObject")
' Note If..Exists. Then, Else ... End If construction
If objFSO.FolderExists(strDirectory) Then
Set objFolder = objFSO.GetFolder(strDirectory)
Else
Set objFolder = objFSO.CreateFolder(strDirectory)
End If
If err.number = vbEmpty then
Set objShell = CreateObject("WScript.Shell")
Else WScript.echo "VBScript Error: " & err.number
End If
-----------------------
Script 2 - backup files from old Wintegrate version to c:\tempkcs\session
-----------------------
set oFSO=createobject("scripting.filesystemobject")
set oShell=createobject("wscript.shell")
on error resume next
sFile=oShell.regread("HKEY_LOCAL_MACHINE\SOFTWARE\ Microsoft\Windows NT\CurrentVersion\Fonts\IbsFont")
on error goto 0
if sFile="" then
else
set oFile=ofso.getfile(sFile)
sfolder=oFile.parentfolder & "\session"
ofso.copyfolder sFolder , "c:\tempkcs\winteg", true
end if
------------------------
Script 3 - copys files in C:\new winteg folder\session
-------------------------
set oFSO=createobject("scripting.filesystemobject")
set oShell=createobject("wscript.shell")
on error resume next
sFile=oShell.regread("HKEY_LOCAL_MACHINE\SOFTWARE\ Microsoft\Windows NT\CurrentVersion\Fonts\IbsFont")
on error goto 0
if sFile="" then
' DO NOTHING
else
' Copy files from source to destination
set oFile=ofso.getfile(sFile)
sfolder=oFile.parentfolder & "\session"
ofso.copyfolder "c:\tempkcs\winteg" , sFolder, true
end if
----------------------------
Ok questions
How do i add to Script 3 to copy everything from c:\tempkcs\winteg to the following folders:
C:\[Path from Ibs font]\Session
C:\[Path from Ibs font]\KCS\Session605
Also after that is completed i want it to remove the c:\tempkcs folder from the c: so everything is nice and tidy.
Thanks,
Simon
Last edited by simons2009; 28th May 2009 at 05:14 AM.
I have altered the script inside of the quote above some what so should help you out to a degree.
You should be able to combine the 3 scripts together ( obviously getting rid of the repeated variables ie oFSO etc and keep all the variables at the top of the script and it will obviously make it a longer script.
What you can also do is the common functions such as deleting the registry key etc you could make as functions and call the functions from within the main script.
I have not got time to have a go at it right now but will have a go at it when I get home this evening unless srochford beats me to it lol
Ill give the script you made try soon, the truth is I do not want to combine all 3, as I have the installer running in the correct order during the installation process so I am happy with them kept separate.
My boss asked me another question which makes things more complicated.
Can we adjust the script to look at and use the TEMP folder specified the windows environmental variables instead of specifying the folder and making it in the c:\ etc
For instance my TEMP location is %SystemRoot%\TEMP
Then we can make the tempkcs in that folder then delete it afterword.
Thanks again,
Simon :-D
Last edited by simons2009; 28th May 2009 at 08:45 AM.
Looks like i bet you to it lol here is what im using now, thank you all so much.
Backup session script
Code:set oFSO=createobject("scripting.filesystemobject") set oShell=createobject("wscript.shell") Dim objFSO, objFiles, objShell, intCount Dim strFile, strName, strLongName, strDirectory, strEnv, strExt Set objShell = CreateObject("Wscript.Shell") strEnv = objShell.ExpandEnvironmentStrings("%temp%") intcount = 0 on error resume next sFile=oShell.regread("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Fonts\IbsFont") on error goto 0 if sFile="" then else set oFile=ofso.getfile(sFile) sfolder=oFile.parentfolder & "\session" ofso.copyfolder sFolder , strEnv & "\tempkcs" , true end if
Last edited by simons2009; 2nd June 2009 at 08:07 AM.
Whoops the copy and paste from the VMWare machine played up
Here is the restore script:
Code:set oFSO=createobject("scripting.filesystemobject") set oShell=createobject("wscript.shell") Dim objFSO, objFiles, objShell, intCount Dim strFile, strName, strLongName, strDirectory, strEnv, strExt Set objShell = CreateObject("Wscript.Shell") strEnv = objShell.ExpandEnvironmentStrings("%temp%") intcount = 0 on error resume next sFile=oShell.regread("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Fonts\IbsFont") on error goto 0 if sFile="" then ' DO NOTHING else ' Copy files from source to destination set oFile=ofso.getfile(sFile) sfolder=oFile.parentfolder ofso.copyfolder strEnv & "\tempkcs" , sFolder & "\session", true ofso.copyfolder strEnv & "\tempkcs" , sFolder & "\KCS\Session605", true oFSO.DeleteFolder strEnv & "\tempkcs", True end if
no problem - just thought they looked the same lol. Let me guess you need your 2nd coffee lol J/K
There are currently 1 users browsing this thread. (0 members and 1 guests)