Solved

%USERPROFILE% back up in VBScript

Posted on 2009-03-29
3
532 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
ID: 24015095
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
ID: 31564110
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
ID: 24017871
Happy to help - thanx for the grade! :^)
0

Featured Post

U.S. Department of Agriculture and Acronis Access

With the new era of mobile computing, smartphones and tablets, wireless communications and cloud services, the USDA sought to take advantage of a mobilized workforce and the blurring lines between personal and corporate computing resources.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

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…
This article is the result of a quest to better understand Task Scheduler 2.0 and all the newer objects available in vbscript in this version over  the limited options we had scripting in Task Scheduler 1.0.  As I started my journey of knowledge I f…
In a recent question (https://www.experts-exchange.com/questions/28997919/Pagination-in-Adobe-Acrobat.html) here at Experts Exchange, a member asked how to add page numbers to a PDF file using Adobe Acrobat XI Pro. This short video Micro Tutorial sh…
Email security requires an ever evolving service that stays up to date with counter-evolving threats. The Email Laundry perform Research and Development to ensure their email security service evolves faster than cyber criminals. We apply our Threat…

809 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