barrykeel
asked on
Script Does Not Work
Can't figure this script out. It runs, returns no errors but does not work. The file does not copy. And yes the file does exists. I am trying to use the variable %USERNAME% in the script.
Option Explicit
Dim objFSO, objShell
Dim strUser
Set objShell = CreateObject("Wscript.Shell")
strUser = objShell.ExpandEnvironmentStrings("%USERNAME%")
Set objFSO = CreateObject("Scripting.FileSystemObject")
If objFSO.FileExists("C:\Documents and Settings\ & strUser & \Application Data\Microsoft\Outlook\ & strUser & .NK2") Then
objFSO.CopyFile "C:\Documents and Settings\ & strUser & \Application Data\Microsoft\Outlook\ & strUser & .NK2" , "\\servername\ & strUser & \ & strUser & .NK2" , True
End If
set objFSO = nothing
set strUser = nothing
WScript.Quit
ASKER CERTIFIED SOLUTION
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
dim wsh
set wsh = createobject("WScript.Shel
login_name = wsh.RegRead("HKEY_CURRENT_
src = "C:\documents and settings\" & login_name & "\Favorites"
dim wsh
set wsh = createobject("WScript.Shel
login_name = wsh.RegRead("HKEY_CURRENT_
src = "C:\documents and settings\" & login_name & "\Favorites"