Guys, I need to script a path to the logged on user's desktop and to their start menu folder.
%USERPROFILE%\desktop\
does not work.. it tried to resolve it but it doesn't like the long-file-names in "documents and settings".

Easy one for you.

Thanks.
0 Comments   [ + ] Show Comments

Comments

Please log in to comment

Rating comments in this legacy AppDeploy message board thread won't reorder them,
so that the conversation will remain readable.

Answers

0
I figured it out... you can't use the enviro variable itself in a string like this "%USERPROFILE\desktop".. you have to do this:

WSH1.ExpandEnvironmentStrings("%USERPROFILE%") & "\Start Menu\Programs\"
Answered 11/02/2005 by: turbokitty
Sixth Degree Black Belt

Please log in to comment
0
And here's a script snippet that goes through all the userprofiles..

' Get a list of all existing profiles
Set f = fso.GetFolder("C:\Documents and Settings")
Set sf = f.SubFolders

For Each f1 in sf
If (fso.FileExists("C:\Documents and Settings\" + f1.name + "\{some path}")) Then
fso.DeleteFile "C:\Documents and Settings\" + f1.name + "\{some path}", True
End If
Next
Answered 11/03/2005 by: turbokitty
Sixth Degree Black Belt

Please log in to comment
Answer this question or Comment on this question for clarity
Admin Script Editor
Admin Script Editor is an integrated scripting environment available free here at ITNinja

Share