Solved

%USERPROFILE% back up in VBScript

Posted on 2009-03-29
3
535 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Welcome back!  My apologies for taking so long to write part two of this series; it's been a long time coming!  As I promised in Part 1, this article will focus on how to locate those elusive AD properties that you are searching for.  Why is this us…
Welcome, welcome!  If you are new to the series and haven't been following along, please take a brief moment to review the first three installments: Part 1 (http://www.experts-exchange.com/Programming/Languages/Visual_Basic/VB_Script/A_266-VBScri…
If you're a developer or IT admin, you’re probably tasked with managing multiple websites, servers, applications, and levels of security on a daily basis. While this can be extremely time consuming, it can also be frustrating when systems aren't wor…
There are cases when e.g. an IT administrator wants to have full access and view into selected mailboxes on Exchange server, directly from his own email account in Outlook or Outlook Web Access. This proves useful when for example administrator want…

717 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