Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3228154
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T16:39:31+00:00 2026-05-17T16:39:31+00:00

Let me start by saying that I’m a linux guy and not really familiar

  • 0

Let me start by saying that I’m a linux guy and not really familiar with VBS or even windows global variables.

I’m being called upon to update a VBS script which basically copies the latest version of a access form to the computer. Currently it puts this access form in C:\MedMaint. The problem is that we do not run as administrators in this location. So when a new user tries to access the vbs script, the folder must be deleted by the original user. I need to change this script to the linux equivalant of ~/MedMaint, or “C:\Documents and Settings\MyUserName\Application Data\MedMaint”

Here is a sample of the code

    If Not FSO.FileExists("c:\MedMaint\" & File.Name) Then
        FSO.CopyFile File.Path, "c:\MedMaint\"          ' copy the missing file
    Else 
        Set RPFile = FSO.GetFile("c:\MedMaint\" & File.Name)    ' Get the file object from the local object
        If (File.DateLastModified >= RPFile.DateLastModified) Then
            FSO.CopyFile File.Path, "c:\MedMaint\" 

I would like to know how to change the c:\MedMaint\ reference to the user’s home dir

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-17T16:39:32+00:00Added an answer on May 17, 2026 at 4:39 pm

    To get the path of the user’s profile folder (e.g. C:\Documents and Settings\<username> in Windows XP or C:\Users\<username> in Windows Vista), you can do any of the following:

    • Evaluate the USERPROFILE environment variable using the WshShell.ExpandEnvironmentStrings method:

      Set oShell = CreateObject("WScript.Shell")
      strHomeFolder = oShell.ExpandEnvironmentStrings("%USERPROFILE%")
      
    • Retrieve the folder path using the Shell.Namespace method:

      Const ssfPROFILE = &H28
      Set oShell = CreateObject("Shell.Application")
      strHomeFolder = oShell.NameSpace(ssfPROFILE).Self.Path
      

    If you need the path of the application data folder (e.g. C:\Documents and Settings\<username>\Application Data in Windows XP or C:\Users\<username>\AppData\Roaming in Windows Vista), you can use similar code:

    Set oShell = CreateObject("WScript.Shell")
    strHomeFolder = oShell.ExpandEnvironmentStrings("%APPDATA%")
    
    ''# or
    
    Const ssfAPPDATA = &H1A
    Set oShell = CreateObject("Shell.Application")
    strHomeFolder = oShell.NameSpace(ssfAPPDATA).Self.Path
    

    To append a folder name to a path, you could simply use string concatenation like this:

    strMedMaintFolder = strHomeFolder & "\MedMaint"
    

    Alernatively, if your script contains many path concatenations, I suggest using the FileSystemObject.BuildPath method, because it takes care of path separators (\) for you:

    Set oFSO = CreateObject("Scripting.FileSystemObject")
    strMedMaintFolder = fso.BuildPath(strHomeFolder, "MedMaint") 
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Let me start by saying that I do not advocate this approach, but I
Let me start out by saying that I'm not a JavaScript developer so this
First off, let me start off that I am not a .net developer. The
Let me start off by saying that this is my first real Cocoa app.
Ok, let me start out by saying that I am brand new to MVC.
Ok, let me start off by saying that I'm don't have the slightest clue
Okay, so let me start by saying: PLEASE do not tell me how to
Let me start by saying I'm a huge fan of the elegance of this
Before I start with the real question, let me just say that I might
Let me start by saying I have looked at many similar questions asked, but

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.