• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 259
  • 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
0
snyperj
Asked:
snyperj
1 Solution
 
Chris BottomleyCommented:
AppFolder = "W:\Apps\users\" & vuser

Chris
0
 
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.)
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

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