Please help editing this .vbs

Posted on 2011-10-26
Last Modified: 2012-05-12
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
Question by:snyperj
    LVL 59

    Accepted Solution

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


    Author Comment

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

    Featured Post

    Threat Intelligence Starter Resources

    Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

    Join & Write a Comment

    In this article we want to have a look at the directory attributes which are used by Microsoft to store the so called Security Identifiers (SID). These SIDs plays an important role in delegating and granting permissions and in authentication of trus…
    Well hello again!  Glad to see you've made it this far without giving up.  In this, the fourth installment of my popular series, I'm going to cover functions and subroutines, what they are, and why they are useful.  Just in case you stumbled onto th…
    To add imagery to an HTML email signature, you have two options available to you. You can either add a logo/image by embedding it directly into the signature or hosting it externally and linking to it. The vast majority of email clients display l…
    Internet Business Fax to Email Made Easy - With eFax Corporate (, you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…

    733 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    17 Experts available now in Live!

    Get 1:1 Help Now