Como obter um caminho com o usuário variável no VBscript
Preciso salvar, mover e excluir um arquivo. Mas quando faço isso, quero permitir que ele salve meus arquivos nos documentos do usuário conectado.
Aqui está o meu código:
Set oWS = WScript.CreateObject("WScript.Shell")
' Get the %userprofile% in a variable, or else it won't be recognized
userProfile = oWS.ExpandEnvironmentStrings( "%userprofile%" )
objDoc.SaveAs("userprofile & "\Downloads\test.doc")
objWord.Quit
Const strFolder = "userprofile & "\Downloads\System Information\", strFile = "userprofile & "\Downloads\test.doc"
Const Overwrite = True
Dim oFSO
Set oFSO = CreateObject("Scripting.FileSystemObject")
If Not oFSO.FolderExists(strFolder) Then
oFSO.CreateFolder strFolder
End If
oFSO.CopyFile strFile, strFolder, Overwrite
oFSO.DeleteFile("userprofile & "\Downloads\test.doc")