Get User Desktop Path

Get User Desktop Path

Anonymous
Not applicable
750 Views
5 Replies
Message 1 of 6

Get User Desktop Path

Anonymous
Not applicable
I need the string path to the all users desktop and wrote 2 functions which I test only under XP where works well, and need test assistance just know if those functions return the correct desktop path in other Windows versions, especially in Vista and 7.

No need to post the actual string that the functions return (this is a private info), I wish just to confirm if they works correct and on which Windows version you tested.


Thank in advance for your assistance!

Anubis
-- TEST #1 --// Max 9 +
fn getDesktopPath_FN1 = (
env = dotNetClass "System.Environment"
env.ExpandEnvironmentVariables(@"&#xAL;LUSERSPROFILE%\Desktop")
)

desk1 = getDesktopPath_FN1()

-- TEST #2 --// Max 2008 + (or AVG for older)
desk2 = ""
if HiddenDOSCommand != undefined then
(
fn getDesktopPath_FN2 = (
tmpFile = (GetDir #temp + "\\dos.txt")
SysDrive = (sysInfo.windowsdir) +":\\"
cmd = "echo &#xAL;LUSERSPROFILE%\Desktop>\"" + tmpFile + "\""
HiddenDOSCommand cmd startpath:SysDrive
f = openFile tmpFile mode:"r"
desk = ReadLine f ; close f
deleteFile (GetDir #temp + "\\dos.txt")
desk
)

desk2 = getDesktopPath_FN2()
)
else (messageBox "This script function required AVG!" title:"Woops...")

clearListener()
format "FN(1) result = %\nFN(2) result = %\n" desk1 desk2

/*
Expected result for public Desktop should be:
XP or earlier : "C:\Documents and Settings\All Users\Desktop"
Vista or later: "C:\Users\Public\Desktop"
*/

-- Optional -- uncomment next 2 lines and test one-by-one:
--ShellLaunch desk1 ""
--ShellLaunch desk2 ""

Some characters replaced by post form... attachment not works too (right now?)
Download link to the script file:
http://narod.ru/disk/26702278000/getDesktopPath.ms.html
0 Likes
751 Views
5 Replies
Replies (5)
Message 2 of 6

Steve_Curley
Mentor
Mentor
Any text within CODE tags should not be altered, but make sure the CODE tags are in place before previewing or submitting.
Like all non-image files, *.ms must be zipped or they won't attach.

Max 2016 (SP1/EXT1)
Win7Pro x64 (SP1). i5-3570K @ 4.4GHz, 8Gb Ram, DX11.
nVidia GTX760 (2GB) (Driver 430.86).

0 Likes
Message 3 of 6

Anonymous
Not applicable
Maybe the string "&#xAL;L" cause conflict with some php variable?
--In CODE tag goes this:
"&#xAL;L"


Huh, its changed out of the CODE tag too 😉 Its a percentage sign + "ALL".
The attachment was my fall, I used rar not zip before, thanks.

getdesktoppath.zip

0 Likes
Message 4 of 6

Steve_Curley
Mentor
Mentor
The % issuse has been raised before, and reported to the devs. I'm still not sure why it happens because unlike < and > it is not an "HTML Entity". Those may still go wrong outside a code section - it depends on what is in between them.

I'll re-raise the problem, but don't hold your breath...

Max 2016 (SP1/EXT1)
Win7Pro x64 (SP1). i5-3570K @ 4.4GHz, 8Gb Ram, DX11.
nVidia GTX760 (2GB) (Driver 430.86).

0 Likes
Message 5 of 6

MedalHellWay
Collaborator
Collaborator
Hi Anubis

This is the result of my test of your script in Windows 7 Home Premium 64bit


OK
FN(1) result = C:\ProgramData\Desktop
FN(2) result = C:\ProgramData\Desktop
OK
OK


I hope that it can be helpful for your work 🙂

Ciao
Michele
0 Likes
Message 6 of 6

Anonymous
Not applicable
Many thanks Michele !
0 Likes