Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

%USERPROFILE% back up in VBScript

Posted on 2009-03-29
3
Medium Priority
?
538 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 2000 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

Technology Partners: 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, 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…
Introduction During my participation as a VBScript contributor at Experts Exchange, one of the most common questions I come across is this: "I have a script that runs against only one computer. How can I make it run against a list of computers in …
Have you created a query with information for a calendar? ... and then, abra-cadabra, the calendar is done?! I am going to show you how to make that happen. Visualize your data!  ... really see it To use the code to create a calendar from a q…
Want to learn how to record your desktop screen without having to use an outside camera. Click on this video and learn how to use the cool google extension called "Screencastify"! Step 1: Open a new google tab Step 2: Go to the left hand upper corn…
Suggested Courses

636 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