Link to home
Start Free TrialLog in
Avatar of snyperj
snyperjFlag for United States of America

asked on

Please help editing this .vbs

I am trying to use a script to create a subfolder that is named the same as the current user.  The subfolder should be inside the users folder.  I have a variable(vuser) holding the username, but I don't know how to concatenate the variable value into the AppFolder name.  Please help,  Thanks

I would also like this to create the \Apps\users folders too if they didn't already exist (they should always be there... but just in case they don't..)


Public fs
Public WshShell
Dim objNetwork
Dim vuser

Set objNetwork = CreateObject("WScript.Network")
vuser = objNetwork.UserName

Set fs = CreateObject("Scripting.FileSystemObject")

AppFolder = "W:\Apps\users\" vuser

If fs.FolderExists(AppFolder) = False then
      fs.CreateFolder AppFolder

End If
ASKER CERTIFIED SOLUTION
Avatar of Chris Bottomley
Chris Bottomley
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of snyperj

ASKER

I SO should have known that.

It doesn't create the parent folders (W:\Apps\users)  if they don't exist... but I figured out how to do that (I think.)