2
I have enough knowledge about registry files that i know how and where to change the desktops location through a script.
I am looking for a way to "refresh" (update/reload/synchronize) the desktop once changes to the registry occur.
The solution needs to be done automatically, i.e. Ran from a script or program however I can not and will not want to kill the explorer.exe process as that harms more of the system than intended.
Notes related to answers, not question:
The F5 refresh Apparently works but I have so far been able to get it to work with an autoit script. The issue was i was changing an environment variable value which was just a default location of it, and did not utilize the windows api of SHSetKnownFolder. I need to figure out how to get this function inside my batch/vbs scripts.
If you believe Killing the explorer.exe forcefully does not harm the computer, i can accept that if the fact that the amount of time needed to reboot it far outweighs the basic method of changing the desktop location through the user interface.
The thing may be intentionally looking for is a windows powershell cmdlett, that requires api call SHSetKnownFolderPath.
The thing that i want to happen is what occurs at the end of this video but from a batch or vbs script.
Comments are not for extended discussion; this conversation has been moved to chat.
– Mokubai – 2016-07-10T20:44:45.687Wouldn't it suit your purpose to just completely change the contents of the same location? Maybe use a symbolic link; change the link target, then trigger F5. – JDługosz – 2016-07-10T23:57:10.270
@JDługosz : we have already been over this. F5 does not update the desktop. While in hindsight it should, it does not do it for this class of problems – Jouster500 – 2016-07-10T23:58:57.340
I mean, by not changing the name of the directory but seemingly changing the contents of the same directory, F5 would work normally as with any normal change. It no longer needs the load-time settings to be reloaded. Follow me? – JDługosz – 2016-07-11T00:17:44.863
Another thought: there are settings changed broadcast messages that are sent to top-level windows. Maybe it responds to that? – JDługosz – 2016-07-11T00:18:56.197
@JDługosz ah yes that method.While for smaller purposes this would suit what I need, however the original scope of the project that i had in mind for this does not want this. The aim was to turn the desktop into a moving library that would change its contents to current location that a user was in the file system. Kind of like how user is operating within a terminal. I wanted to implement this for the desktop so i can quickly work on projects and save everything to it in a user friendly manner. The aim is to not move files to new locations because sometimes the locations im in actively need it – Jouster500 – 2016-07-11T00:25:42.527
Pls read again. Symbolic link. Change one thing, seems to the explorer to change whole contents. Change the symlink destination, rather than the registry entry. – JDługosz – 2016-07-11T00:28:20.833
@JDługosz : oh shoot, im sorry. So like when you right click the desktop folder, and in the location tab, change that folder location; that is changing the symlink for the desktop? – Jouster500 – 2016-07-11T00:30:42.140
I don't know. I think it varies with the Windows version. Best if you do mimic that unless it's internal to its own dialog box prompt and can't be triggered. But I was thinking you create a symlink and set the desktop folder once, to that, putting up with the restart. Now you can retarget the symlink and explorer thinks you changed the whole contents of the self-same directory. Symbolic link and junction can be treated differently; try each to see. – JDługosz – 2016-07-11T00:36:39.213
@JDługosz :That is a pretty clever way of approaching it and it may actually save me a lot of lines of code! I still don't believe that its changes can take place like that. Are you a linux user yourself? If you ever wanted to make changes to a file so for example ~/.bashrc, you would need to source it so the changes would take place. So perhaps we need to look for something which "source" the desktop – Jouster500 – 2016-07-11T00:41:32.583
The desktop isn't a file. Explorer does handle changes made to the directory tree representing the desktop, just not the setting saying which directory that is. – JDługosz – 2016-07-11T11:17:28.473
Check the wrapper function here.. using PS. http://stackoverflow.com/questions/25709398/set-location-of-special-folders-with-powershell
– w32sh – 2016-07-17T20:12:19.830