Advertisement
Guest User

Untitled

a guest
Jun 30th, 2019
138
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. ' Necessário para correr em admin
  2.  
  3.  
  4. Set WshShell = WScript.CreateObject("WScript.Shell")
  5. If WScript.Arguments.Length = 0 Then
  6.   Set ObjShell = CreateObject("Shell.Application")
  7.   ObjShell.ShellExecute "wscript.exe" _
  8.     , """" & WScript.ScriptFullName & """ RunAsAdministrator", , "runas", 1
  9.   WScript.Quit
  10. End if
  11.  
  12.  
  13. ' Objetivo - Copia de segurança de umas bastas
  14.  
  15. ' inicio
  16.  
  17.  
  18. ' criar variavel e atribuir carateristica de gestao de ficheiros do sistema
  19. Dim dtmValue, strDate, strTime
  20. Dim fso
  21. Dim oshell
  22. Set oshell = CreateObject("WScript.Shell")
  23. Set fso = CreateObject("Scripting.FileSystemObject")    
  24. Dim CurrentDirectory
  25.  
  26. 'Definiçao do caminho atual
  27.  
  28. CurrentDirectory = fso.GetAbsolutePathName(".")
  29.  
  30. ' Criação da pasta com a data atual. Aqui será feita a nova cópia de segurança
  31.  
  32. dtmValue = Now()
  33. strDate = CurrentDirectory & "\Backup " & Day(dtmValue) & "_" & Month(dtmValue) & "_" & Year(dtmValue)
  34. FSO.CreateFolder(strDate)
  35.  
  36.  
  37. ' Indicação dos caminhos a copiar e a mensagem dessas atividades
  38.  
  39. Wscript.Echo "A iniciar copia de " & "%USERPROFILE%\Desktop"
  40.  
  41. fso.CopyFolder oshell.ExpandEnvironmentStrings ("%USERPROFILE%\Desktop"), strDate & "\Desktop"
  42.  
  43. WScript.Echo "Copia concluída de " & "%USERPROFILE%\Desktop"
  44.  
  45.  
  46.  
  47. Wscript.Echo "A iniciar copia de " & "%USERPROFILE%\Documents"
  48.  
  49. fso.CopyFolder oshell.ExpandEnvironmentStrings ("%USERPROFILE%\Documents"), strDate & "\Documents"
  50.  
  51. WScript.Echo "Copia concluída de " & "%USERPROFILE%\Documents"
  52.  
  53.  
  54.  
  55. Wscript.Echo "A iniciar copia de " & "%USERPROFILE%\Downloads"
  56.  
  57. fso.CopyFolder oshell.ExpandEnvironmentStrings ("%USERPROFILE%\Downloads"), strDate & "\Downloads"
  58.  
  59. WScript.Echo "Copia concluída de " & "%USERPROFILE%\Downloads"
  60.  
  61.  
  62.  
  63. WScript.Echo "A iniciar copia de " & "%USERPROFILE%\Videos"
  64.  
  65. fso.CopyFolder oshell.ExpandEnvironmentStrings ("%USERPROFILE%\Videos"), strDate & "\Videos"
  66.  
  67. WScript.Echo "Copia concluída de " & "%USERPROFILE%\Videos"
  68.  
  69.  
  70.  
  71. Wscript.Echo "A iniciar copia de " & "%USERPROFILE%\Music"
  72.  
  73. fso.CopyFolder oshell.ExpandEnvironmentStrings ("%USERPROFILE%\Music"), strDate & "\Music"
  74.  
  75. WScript.Echo "Copia concluída de " & "%USERPROFILE%\Music"
  76.  
  77.  
  78.  
  79. Wscript.Echo "A iniciar copia de " & "%USERPROFILE%\Pictures"
  80.  
  81. fso.CopyFolder oshell.ExpandEnvironmentStrings ("%USERPROFILE%\Music"), strDate & "\Pictures"
  82.  
  83. WScript.Echo "Copia concluída de " & "%USERPROFILE%\Pictures"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement