Is there a short cut for desktop folder in Windows batch?

batch-file

Solution

You can use `"%USERPROFILE%\Desktop"` but I don't know from which version of Windows it is built in.

If your want the real folder where Desktop is located then use this code in the bach

for /F "skip=2 tokens=3* delims= " %%a in ('reg query "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders" /v Desktop') do set DesktopFolder="%%a"

This requires the reg.exe to be available (again, I don't know from which version of Window it is there) and it will set the DesktopFolder variable to the path of the Desktop.

Problem

``` C:\Documents and Settings\Administrator\Desktop ``` I don't want to type the above each time to refer to a file on the desktop

Original source

Related problems