How to programmatically restart windows explorer process

After parsing some of the earlier answers and doing a bit of research, I’ve created a little complete example in C#. This closes the explorer shell then waits for it to completely shut down and restarts it. Hope this helps, there’s a lot of interesting info in this thread. using System; using System.Collections.Generic; using System.Linq; … Read more

Drag Drop from .NET application to Explorer

It’s pretty straight-forward, just call DoDragDrop in a MouseDown event. You’ll need actual files on disk for this to work. private void Form1_MouseDown(object sender, MouseEventArgs e) { string[] files = new string[] { @”c:\temp\test.txt” }; this.DoDragDrop(new DataObject(DataFormats.FileDrop, files), DragDropEffects.Copy); }

Java – Sort Strings like Windows Explorer

This is my second try to answer this. I used http://www.interact-sw.co.uk/iangblog/2007/12/13/natural-sorting as a start. Unfortunatly I think I found there problems as well. But I think in my code these problems are correctly adressed. Info: Windows Explorer uses the API function StrCmpLogicalW() function to do its sorting. There it is called natural sort order. So … Read more

Programmatically select multiple files in windows explorer

This should be possible with the shell function SHOpenFolderAndSelectItems EDIT Here is some sample code showing how to use the function in C/C++, without error checking: //Directory to open ITEMIDLIST *dir = ILCreateFromPath(_T(“C:\\”)); //Items in directory to select ITEMIDLIST *item1 = ILCreateFromPath(_T(“C:\\Program Files\\”)); ITEMIDLIST *item2 = ILCreateFromPath(_T(“C:\\Windows\\”)); const ITEMIDLIST* selection[] = {item1,item2}; UINT count = … Read more

How to I launch a ruby script from the command line by just its name?

Associate the “.rb” file extension with the ruby interpreter. On Windows XP, one way to do this is to select “Tools|Folder options” in the file explorer, and to setup the association in the “File types” tab. Another way would be to enter the following on the commandline which creates this file association for you: assoc … Read more