I'm experimenting with Folder Redirection and after getting it set up, I quickly realized that any VBS scripts that have environmental variables such as %UserProfile% become unusable.
For example:
C:\MD %UserProfile%\Desktop\Not_Created_On_Real_Desktop\
And
'Place to deposit excel output file
Depo=oShell.ExpandEnvironmentStrings("%userprofile%" & "\Desktop\Folder_This_User_Needs_Easy_Access_To\")
if not objfso.folderexists(Depo) then
objFSO.CreateFolder(Depo)
end if
These no longer work when using Folder Redirection. I'm hoping there is a work around for this because a lot of my existing scripts depend on this variable remaining valid. I've found that .NET is able to pull the redirected folder with:
Environment.GetFolderPath(Environment.SpecialFolder.DesktopDirectory)
I haven't had much luck find an equivalent for VBS though.
Any help is appreciated. Thanks!
I think SpecialFolders is what you are looking for
Depo=oShell.SpecialFolders("Desktop") & "\Test"
It will return the location of the Desktop-folder also with Redirected Folders.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With