Photo Gallery
Member List
Search
Calendars
FAQ
Ticket List
Log Out
Forums
Register
Login
My Profile
Inbox
Address Book
My Subscription
My Forums
cant write to user profile
Logged in as: Guest
arrSession:exec spGetSession 2,2,59282
Active Users: There are
0
members and
0
guests.
Users viewing this topic: none
Printable Version
All Forums
>>
[Scripting]
>>
WSH & Client Side VBScript
>> cant write to user profile
Do you like VisualBasicScript.com? Link to us and help spread the word about our forum. Thanks!
Page:
[1]
Login
Message
<< Older Topic
Newer Topic >>
cant write to user profile -
4/18/2008 2:11:25 AM
aburt
Posts: 104
Score: 0
Joined: 12/4/2006
Status:
offline
Hello
I have a script that copies a file to the users profile directory however although I can manually copy a file to this directory when I run my script I get permission denied. Anybody have any clue as to why this is happening
strComputer = "." FilePath = Split(WScript.ScriptFullName, WScript.ScriptName)(0) Set objFSO = CreateObject("Scripting.FileSystemObject") Set objShell = CreateObject("Wscript.Shell") strUserProfile = objshell.ExpandEnvironmentStrings("%USERPROFILE%") strWinDir = objShell.ExpandEnvironmentStrings("%SYSTEMROOT%") DestFP = strUserProfile '& """\Local Settings\Temp""" WScript.Echo FilePath WScript.Echo DestFP WScript.Echo strWinDir If objFSO.FolderExists(DestFP) Then objFSO.CopyFile FilePath & "erunas.exe", DestFP, True Else WScript.Echo "File was copied" objFSO.CopyFile FilePath & "erunas.exe", DestFP, True End If
Post #: 1
RE: cant write to user profile -
4/18/2008 3:32:43 AM
dm_4ever
Posts: 2641
Score: 46
Joined: 6/29/2006
From: Orange County, California
Status:
offline
Have you tried adding a
\
to the end of your destination path?
_____________________________
dm_4ever
My philosophy:
K.I.S.S - Keep It Simple Stupid
Read Me:
http://www.visualbasicscript.com/m_24727/tm.htm
Frequently Asked Stuff:
http://www.visualbasicscript.com/m_47117/tm.htm
(in reply to
aburt
)
Post #: 2
RE: cant write to user profile -
4/18/2008 4:06:27 AM
aburt
Posts: 104
Score: 0
Joined: 12/4/2006
Status:
offline
Thanks for your reponse
when I do that I get bad file name or number
(in reply to
dm_4ever
)
Post #: 3
RE: cant write to user profile -
4/18/2008 4:21:12 AM
aburt
Posts: 104
Score: 0
Joined: 12/4/2006
Status:
offline
I got it figured out thanks I changed my
DestFP = strUserProfile & """\Local Settings\Temp\"""
to
DestFP = strUserProfile & "\Local Settings\Temp\"
Its working now thanks.
(in reply to
aburt
)
Post #: 4
If you found our site useful please link to us
<a href="http://www.visualbasicscript.com">VisualBasicScript.com</a>
.
All Forums
>>
[Scripting]
>>
WSH & Client Side VBScript
>> cant write to user profile
Page:
[1]
Jump to:
Select a Forum
All Forums
----------------------
[Welcome]
- - Forum Rules
- - Test Posting Messages
- - New Member Area/Introduction
[Scripting]
- - WSH & Client Side VBScript
- - WSH & Client Side VBScript Tutorial
- - Post a VBScript
- - Windows PowerShell
- - ASP
- - ASP.NET
- - Windows Script Components
[General Forum]
- - Other Programming/Scripting Languages
- - Suggestions & Feedback
- - Off-Topic Lounge
New Messages
No New Messages
Hot Topic w/ New Messages
Hot Topic w/o New Messages
Locked w/ New Messages
Locked w/o New Messages
Post New Thread
Reply to Message
Post New Poll
Submit Vote
Delete My Own Post
Delete My Own Thread
Rate Posts
Forum Software ©
ASPPlayground.NET
Advanced Edition
2.5.5 ANSI