Using Username in a Path in a VBS Script
Posted on 2010-11-24
As part of our VBS login script, we use it to copy templates from a network share to the local machine. The code compares the date of the file on the local machine to the file on the network, if it's older, it copies down the current one. The script uses/reads a text file to determine which documents to copy. Currently the files are copied to a static location in c:\program files. What I'm trying to do is copy the templates to each user's profile. What I can't figure out is how to impliment the code so it will enter the current user into the path.
The current code that does the copying looks like this:
(the rest of the path is contained in the text files called by &lines)
What I would like to be able to do:
I know that you can't use environ variables in VBS, I put that in there as an example.
I'm using the following code to set the variable, though Im not positive it's correct either.
Set Network = CreateObject("WScript.Network")
CurrentUser = Network.UserName
I can provide more code if needed,