none
Delete a file in a user's roaming profile - logon script RRS feed

  • Question

  • Hello,

    As part of a logon script, I would like to delete a file from %username%\appdata\roaming\foldername\filename and then replace it with another.

    dim path
    path=CreateObject("WScript.Shell").ExpandEnvironmentStrings("%UserProfile%")
    dim objFSO

    Set objFSO = CreateObject("Scripting.FileSystemObject")

    If objFSO.FileExists(PATH & ("\appdata\roaming\foldername\filename")) = True Then

    objFSO.DeleteFile filename 

    objFSO.CopyFile \\server\folder\filename, path & "\appdata\roaming\foldername\filename" Else
    WScript.Quit


    End If

    Am I even close??

    thanks - Adrian


    anr

    Tuesday, May 12, 2015 3:35 AM

Answers

All replies