Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Environment Variable

Status
Not open for further replies.

edo74

Technical User
Oct 29, 2003
7
SK
Hi all,
is there a way to access my desktop folder by script via variable like:
%USERPROFILE%\Local Settings\Desktop?
Looks like "%" is not a valid character in the path,

thank you

Eduard
 
Try something like this:
Set sh=CreateObject("WScript.Shell")
MsgBox sh.SpecialFolders("Desktop")

Hope This Help, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884
 
This works for accessing environment vars:
Code:
set WshShell = WScript.CreateObject("WScript.Shell")
WScript.Echo "WinDir is " & WshShell.ExpandEnvironmentStrings("%WinDir%")

This is better for getting special folders:
Code:
Set Shell = CreateObject("WScript.Shell")
DesktopPath = Shell.SpecialFolders("Desktop")
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top