[wpkg-users] Public desktop strangeness...

Adam Thorn alt36 at cam.ac.uk
Thu Mar 30 11:35:54 CEST 2023


On 29/03/2023 17:12, Marco Gaiarin wrote:
> 
> In my 'config.xml' i have:
> 
>    <variables>
>      <variable name="PublicDesktop" value="%ALLUSERSPROFILE%\Desktop" os=", 5\.[0-2]\.\d{4}" />
>      <variable name="PublicDesktop" value="%PUBLIC%\Desktop" os=", 6\.[0-3]\.\d{4}" />
>      <variable name="PublicDesktop" value="%ALLUSERSPROFILE%\Desktop" os=", 10\.0\.\d{5}" />
>    </variables>
> 
> 
> In Windows 10, in recipes, a row like:
> 
> 	<install cmd='%COMSPEC% /c copy /y "%WPKGROOT%\packages\glpi-%LOCALNET%.url" "%PublicDesktop%\HelpDesk.url"' />
> 
> works as expected, eg, put the Icon on the public desktop. But a row like:
> 
> 	<remove cmd='%COMSPEC% /c del /f /q "%PublicDesktop%\HelpDesk.url"' />
> 
> does not remove it. WHY?! Thanks.

That folder is no longer a "real" directory; it's a junction point:

C:\>dir /al "%allusersprofile%"

01/09/2020  14:45    <JUNCTION>     Application Data [C:\ProgramData]
01/09/2020  14:45    <JUNCTION>     Desktop [C:\Users\Public\Desktop]
01/09/2020  14:45    <JUNCTION>     Documents [C:\Users\Public\Documents]
01/09/2020  14:45    <JUNCTION>     Start Menu 
[C:\ProgramData\Microsoft\Windows\Start Menu]
01/09/2020  14:45    <JUNCTION>     Templates 
[C:\ProgramData\Microsoft\Windows\Templates]

which means, amongst other things, that whilst you can copy files into 
it you cannot enumerate the contents or delete objects. Unhelpfully, it 
seems that del returns zero when it can't find a file so wpkg will 
believe the command has completed successfully...

C:\>dir "%allusersprofile%\desktop"

Directory of C:\ProgramData\desktop

File Not Found

C:\>del "%allusersprofile%\desktop\list.txt"
Could Not Find C:\ProgramData\desktop\list.txt

C:\>echo %errorlevel%
0

If you continue using "%public%\desktop" you will get better results.

Adam


More information about the wpkg-users mailing list