juniorval01
asked on
VB script to create folder to a user profile
Hello,
I have this simple VB script to create a folder to user's profile which works to some extent. The problem I am running into is the profiles in the home directory have a (.cloud) extension (example= jondoe.cloud) The VB script below just recognizes the user name, but not the .cloud. Any ideas anyone??
Dim objFSO, strFolder
strFolder = "\\XXX.local\Site\Home$\%U SERNAME%\W INDOWS\Fon ts"
Set objFSO = CreateObject("Scripting.Fi leSystemOb ject")
If Not objFSO.FolderExists(strFol der) Then
objFSO.CreateFolder(strFol der)
End If
Thanks,
JV
I have this simple VB script to create a folder to user's profile which works to some extent. The problem I am running into is the profiles in the home directory have a (.cloud) extension (example= jondoe.cloud) The VB script below just recognizes the user name, but not the .cloud. Any ideas anyone??
Dim objFSO, strFolder
strFolder = "\\XXX.local\Site\Home$\%U
Set objFSO = CreateObject("Scripting.Fi
If Not objFSO.FolderExists(strFol
objFSO.CreateFolder(strFol
End If
Thanks,
JV
have you tried using "%UserProfile% variable instead on Username?
Can't you just add it in to the path, like:
strFolder = "\\XXX.local\Site\Home$\%U SERNAME%.c loud\WINDO WS\Fonts"
~bp
strFolder = "\\XXX.local\Site\Home$\%U
~bp
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thanks guys for the responses back.
@Rob, I have added the .%USERDOMAIN% and I was able to navigate to the location which is great. But it wont create the folder "FONTS".
Line: 5
Char: 4
Error: Path not found
Code: 800A004C
Any ideas?
@Rob, I have added the .%USERDOMAIN% and I was able to navigate to the location which is great. But it wont create the folder "FONTS".
Line: 5
Char: 4
Error: Path not found
Code: 800A004C
Any ideas?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
@BP,
I went ahead and went with the info you sent me and worked as you expected.
Many thanks to BP and Rob!
I went ahead and went with the info you sent me and worked as you expected.
Many thanks to BP and Rob!
Welcome, glad that helped.
~bp
~bp
Thanks Bill for the support. Thanks JV for the assist points. Glad to help.
Rob.
Rob.