Different operating systems have different desktop paths and different installation locations.
C # You can read the location of your special folders (desktops, favorites, etc.) from the Windows registry.
CodeAs follows:
Using Microsoft. win32; namespace jpgcompact {public partial class mainform: FORM {private void test () {registrykey folders; folders = openregistrypath (registry. currentuser, @ "\ Software \ Microsoft \ Windows \ CurrentVersion \ Explorer \ Shell Folders"); // Windows user desktop path string export toppath = folders. getvalue ("desktop "). tostring (); // Windows user font directory path string fontspath = folders. getvalue ("fonts "). tostring (); // Windows user network neighbor path string nethoodpath = folders. getvalue ("nethood "). tostring (); // Windows user my document path string personalpath = folders. getvalue ("personal "). tostring (); // Windows user Start Menu Program Path string programspath = folders. getvalue ("programs "). tostring (); // For Windows users, the directory path string recentpath = folders. getvalue ("Recent "). tostring (); // The path string sendtopath = folders. getvalue ("sendto "). tostring (); // Windows user Start Menu directory path string startmenupath = folders. getvalue ("startmenu "). tostring (); // Windows user Start Menu startup Item directory path string startuppath = folders. getvalue ("Startup "). tostri Ng (); // Windows user favorites directory path string favoritespath = folders. getvalue ("favorites "). tostring (); // path of the historical Windows user webpage directory string historypath = folders. getvalue ("History "). tostring (); // Windows user cookies directory path string cookiespath = folders. getvalue ("cookies "). tostring (); // Windows user cache directory path string cachepath = folders. getvalue ("cache "). tostring (); // data directory path of the Windows user application string appdatapath = folders. getvalue (" Ppdata "). tostring (); // Windows user print directory path string printhoodpath = folders. getvalue ("printhood "). tostring ();} private registrykey openregistrypath (registrykey root, string s) {S = S. remove (0, 1) + @ "\"; while (S. indexof (@"\")! =-1) {root = root. opensubkey (S. substring (0, S. indexof (@ "\"); s = S. remove (0, S. indexof (@ "\") + 1);} return root ;}}}