• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 263
  • Last Modified:

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
1 Solution
Chris BottomleySoftware Quality Lead EngineerCommented:
AppFolder = "W:\Apps\users\" & vuser

snyperjAuthor Commented:
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.)
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Cloud Class® Course: Ruby Fundamentals

This course will introduce you to Ruby, as well as teach you about classes, methods, variables, data structures, loops, enumerable methods, and finishing touches.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now