Your answer is probably the most efficient, but you can omit the "-command" since it's a trivial one-liner.
Code:
for /f "delims=" %%D in ('powershell "[Environment]::GetFolderPath('Desktop')"') do set desktopPath=%%D
shell:[whatever] is a great shortcut, but only works if you're opening Explorer windows. It's not a construct for use outside of Explorer.
My Computer
At a glance
Windows 7
- OS
- Windows 7





