on-internet
← Community

transfer CurrentDirectory from un-elevated script to elevated one

Stack Overflow ·

I need to copy my file "manufacturer.bmp", which is located in the same directory as the script (in my flash drive), to the system32 directory. I succeed, in getting the variables sourcefile, destinationdirectory, and to elevate my script, but when I elevate it, my sourcefile variable is lost, because of the use of CurrentDirectory, which differs in this mode. Set shell = WScript.CreateObject("WScript.Shell") Set fso = CreateObject("Scripting.FileSystemObject") CurrentDirectory = fso.GetAbsolutePathName(".") sourcefile = fso.buildpath(CurrentDirectory, "manufacturer.bmp") MsgBox(sourcefile) 'C

Comments

Sign in or sign up to comment and upvote.

No comments yet.