1

My Desktop is a redirected profile, so when I run %USERPROFILE% and then go into the Desktop folder, I get "\FILESERVER\RP\MYUSER\Desktop" But when I run %USERPROFILE%\Desktop I get an error "Windows cannot find 'C:\Users\MYUSER\Desktop'...

My question is: Is there a %SOMETHING% to directly get into the desktop folder in a redirected profile environment?

Thanks

user7406533
  • 73
  • 1
  • 9
  • 1
    No, there is no environment variable for that. The folder is redirected at the level of the Windows desktop environment (graphical shell), so you have to query its location using the shell API, e.g. [`SHGetKnownFolderPath`](https://learn.microsoft.com/en-us/windows/desktop/api/shlobj_core/nf-shlobj_core-shgetknownfolderpath) for the known folder `FOLDERID_Desktop`. – Eryk Sun Feb 06 '19 at 00:01
  • If you just want an Explorer window for the desktop, you can use the "shell:" protocol, e.g. `start "" "shell:desktop"`. – Eryk Sun Feb 06 '19 at 01:01
  • What I actually need, is I'm creating a batch file that will copy an application to a folder, and I need a shortcut on the desktop... I can do it with GPO, but I was thinking "If I'm already pushing the batch over GPO, I'll just put it in the file..." – user7406533 Feb 06 '19 at 13:30
  • You can do it with PowerShell, and maybe VBScript, but not pure batch scripting as far as I know. – Eryk Sun Feb 06 '19 at 20:17
  • Possible duplicate of [How do I create a shortcut via command-line in Windows?](https://stackoverflow.com/questions/30028709/how-do-i-create-a-shortcut-via-command-line-in-windows) – Jason Aller Aug 28 '19 at 04:13

0 Answers0