Solved

%USERPROFILE% back up in VBScript

Posted on 2009-03-29
3
530 Views
Last Modified: 2012-05-06
Greetings,
I am havingin trouble getting the Script to recognize %USERPROFILE%.     I have the following Code, and when it runs It doesn't give me any error, but it doesn't create a Folder and it doesn't copy the files over.   Can someone please take a look at my code and see where I am going wrong?
Set fso     = wscript.createobject("Scripting.FileSystemObject")

Set objShell = CreateObject("WScript.Shell")

...

strUserProfile = objShell.ExpandEnvironmentStrings("%USERPROFILE%")

lotusNotes8FolderPath = strUserProfile & "\local settings\application data\lotus\notes\"

...

fso.copyfolder lotusNotes8FolderPath, folder.path & "\Notes8ProfileData", True

Open in new window

0
Comment
Question by:aceklub97
  • 2
3 Comments
 
LVL 67

Accepted Solution

by:
sirbounty earned 500 total points
Comment Utility
Think you just need to test those values - it should work as-is...
Set fso     = wscript.createobject("Scripting.FileSystemObject")

Set objShell = CreateObject("WScript.Shell")

...

strUserProfile = objShell.ExpandEnvironmentStrings("%USERPROFILE%")

lotusNotes8FolderPath = strUserProfile & "\local settings\application data\lotus\notes\"

msgbox strUserProfile

msgbox lotusNotes8FolderPath

msgbox folder.path

fso.copyfolder lotusNotes8FolderPath, folder.path & "\Notes8ProfileData", True

Open in new window

0
 

Author Closing Comment

by:aceklub97
Comment Utility
Thanks for the troubleshooting help.  When i used the msgboxes, I realized that I had the variable as: lotusNotes8FolderPath = strUserProfile & "\local settings\application data\lotus\notes\"
instead of
lotusNotes8FolderPath = strUserProfile & "\local settings\application data\lotus\notes"
the first one would have been good for fso.copyfile, but I was using fso.copyfolder.   After that changes it works correctly.
0
 
LVL 67

Expert Comment

by:sirbounty
Comment Utility
Happy to help - thanx for the grade! :^)
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Script to copy or move mouse-selected collection of files plus targets referenced by shortcuts (.lnk) The purpose of this article is to help illuminate the real challenges and options available (where they may exist) for utilizing simple scriptin…
Deploying a Microsoft Access application in a Citrix environment is not difficult but takes a few steps. However, Citrix system people are often of little help, as they typically know next to nothing about Access. The script provided here will take …
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…
This video shows how to remove a single email address from the Outlook 2010 Auto Suggestion memory. NOTE: For Outlook 2016 and 2013 perform the exact same steps. Open a new email: Click the New email button in Outlook. Start typing the address: …

743 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