none
How to Open WinExplorer and select a file(focus on) with .VBS?

    Question

  • Hello GUYS,

    I am developing an application in .NET with C#, I need to write a .VBS script which will open the Windows Explorer and will select a simple .txt file. Do you have any idea if this is possible with .VBS objects and if yes how?????? On the other hand if this is not possible do you know how to implement it in .NET…or at least any good forum where could I find some help.

    I would appreciate your help.

    Thanks a lot.

     

     

    Thursday, May 25, 2006 9:44 AM

Answers

  • If you dont mind me asking, why do you want to use vb script ?

    and when you say open the windows explorer shell and select the .txt file - do you just want that file to show selected in the shell or are you trying to open this file - which will probably cause notepad to open with it in.

     

     

    Thursday, May 25, 2006 3:48 PM
  • Hello again,
    If somebody is interested, i have just found the answer. The solution is in explorer.exe switches. Here you go an example:

    Process explorer = new Process(); 
                explorer.StartInfo.FileName="Explorer.exe"
                explorer.StartInfo.Arguments = "/n, /e, /select,"+path; 
                try 
                { 
                    explorer.Start(); 
                } 
                catch (Exception ex) 
                { 
                    MessageBox.Show("Error: " + ex.Message); 
                } 

    Hope will help somebody!
    Monday, March 09, 2009 12:05 AM

All replies

  • If you dont mind me asking, why do you want to use vb script ?

    and when you say open the windows explorer shell and select the .txt file - do you just want that file to show selected in the shell or are you trying to open this file - which will probably cause notepad to open with it in.

     

     

    Thursday, May 25, 2006 3:48 PM
  • Hello there,

    I would be really interested in finding a response to this question. I am building an application in WPF (that uses a WCF service binded over netTcpBinding) that at some point enables the user to play a WAV file, and i would like to allow them to open a Windows Explorer window, focused on that file. Thank you in advance!!
    Sunday, March 08, 2009 11:51 PM
  • Hello again,
    If somebody is interested, i have just found the answer. The solution is in explorer.exe switches. Here you go an example:

    Process explorer = new Process(); 
                explorer.StartInfo.FileName="Explorer.exe"
                explorer.StartInfo.Arguments = "/n, /e, /select,"+path; 
                try 
                { 
                    explorer.Start(); 
                } 
                catch (Exception ex) 
                { 
                    MessageBox.Show("Error: " + ex.Message); 
                } 

    Hope will help somebody!
    Monday, March 09, 2009 12:05 AM
  • I don't want to be rough on you. The first thing is that I am a woman.


    The next is that this is a .Net forum.

    -Renee


    (By the way, Is there is something wrong with the last coma in .arguments)
    Monday, March 09, 2009 2:12 AM