Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ' Necessário para correr em admin
- Set WshShell = WScript.CreateObject("WScript.Shell")
- If WScript.Arguments.Length = 0 Then
- Set ObjShell = CreateObject("Shell.Application")
- ObjShell.ShellExecute "wscript.exe" _
- , """" & WScript.ScriptFullName & """ RunAsAdministrator", , "runas", 1
- WScript.Quit
- End if
- ' Objetivo - Copia de segurança de umas bastas
- ' inicio
- ' criar variavel e atribuir carateristica de gestao de ficheiros do sistema
- Dim dtmValue, strDate, strTime
- Dim fso
- Dim oshell
- Set oshell = CreateObject("WScript.Shell")
- Set fso = CreateObject("Scripting.FileSystemObject")
- Dim CurrentDirectory
- 'Definiçao do caminho atual
- CurrentDirectory = fso.GetAbsolutePathName(".")
- ' Criação da pasta com a data atual. Aqui será feita a nova cópia de segurança
- dtmValue = Now()
- strDate = CurrentDirectory & "\Backup " & Day(dtmValue) & "_" & Month(dtmValue) & "_" & Year(dtmValue)
- FSO.CreateFolder(strDate)
- ' Indicação dos caminhos a copiar e a mensagem dessas atividades
- Wscript.Echo "A iniciar copia de " & "%USERPROFILE%\Desktop"
- fso.CopyFolder oshell.ExpandEnvironmentStrings ("%USERPROFILE%\Desktop"), strDate & "\Desktop"
- WScript.Echo "Copia concluída de " & "%USERPROFILE%\Desktop"
- Wscript.Echo "A iniciar copia de " & "%USERPROFILE%\Documents"
- fso.CopyFolder oshell.ExpandEnvironmentStrings ("%USERPROFILE%\Documents"), strDate & "\Documents"
- WScript.Echo "Copia concluída de " & "%USERPROFILE%\Documents"
- Wscript.Echo "A iniciar copia de " & "%USERPROFILE%\Downloads"
- fso.CopyFolder oshell.ExpandEnvironmentStrings ("%USERPROFILE%\Downloads"), strDate & "\Downloads"
- WScript.Echo "Copia concluída de " & "%USERPROFILE%\Downloads"
- WScript.Echo "A iniciar copia de " & "%USERPROFILE%\Videos"
- fso.CopyFolder oshell.ExpandEnvironmentStrings ("%USERPROFILE%\Videos"), strDate & "\Videos"
- WScript.Echo "Copia concluída de " & "%USERPROFILE%\Videos"
- Wscript.Echo "A iniciar copia de " & "%USERPROFILE%\Music"
- fso.CopyFolder oshell.ExpandEnvironmentStrings ("%USERPROFILE%\Music"), strDate & "\Music"
- WScript.Echo "Copia concluída de " & "%USERPROFILE%\Music"
- Wscript.Echo "A iniciar copia de " & "%USERPROFILE%\Pictures"
- fso.CopyFolder oshell.ExpandEnvironmentStrings ("%USERPROFILE%\Music"), strDate & "\Pictures"
- WScript.Echo "Copia concluída de " & "%USERPROFILE%\Pictures"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement