Important alert: (current site time 7/16/2013 2:01:22 AM EDT)
 

VB icon

***Make ANY Folder The Root Of Windows Explorer***

Email
Submitted on: 8/18/1999
By: Jim  
Level: Not Given
User Rating: By 5 Users
Compatibility: VB 4.0 (16-bit), VB 4.0 (32-bit), VB 5.0, VB 6.0
Views: 33409
 
     My Code calls The Windows Explorer with the switch "e,/root," and makes any folder you want the root of the windows explorer
 
code:
Can't Copy and Paste this?
Click here for a copy-and-paste friendly version of this code!
 
Terms of Agreement:   
By using this code, you agree to the following terms...   
  1. You may use this code in your own programs (and may compile it into a program and distribute it in compiled format for languages that allow it) freely and with no charge.
  2. You MAY NOT redistribute this code (for example to a web site) without written permission from the original author. Failure to do so is a violation of copyright laws.   
  3. You may link to this code from another website, but ONLY if it is not wrapped in a frame. 
  4. You will abide by any additional copyright restrictions which the author may have placed in the code or code's description.
				
'**************************************
' Name: ***Make ANY Folder The Root Of Windows Explorer***
' Description:My Code calls The Windows Explorer with the switch "e,/root," and makes any folder you want the root of the windows explorer
' By: Jim
'
' Side Effects:It's a little slow calling the explorer cause i shell it, if you know better please edit at will
'
'This code is copyrighted and has' limited warranties.Please see http://www.Planet-Source-Code.com/vb/scripts/ShowCode.asp?txtCodeId=3096&lngWId=1'for details.'**************************************

'it's a module
'i went a little DIM crazy with the 
'variables but it's still good code...enjoy
Public Sub eRoot(rootpath As String, fldrs As Boolean)
'fldrs is the folders switch, monkey with it and see what you get
On Error Resume Next
Dim EX, ARGU, path, X
If fldrs = True Then
EX = "explorer.exe"
ARGU = " /e,/root, "
path = rootpath$
X = Shell(EX & ARGU & path, 1)
ElseIf fldrs = False Then
EX = "explorer.exe"
ARGU = " n/e,/,root, "
path = rootpath$
X = Shell(EX & ARGU & path, 1)
End If
End Sub


Report Bad Submission
Use this form to tell us if this entry should be deleted (i.e contains no code, is a virus, etc.).
This submission should be removed because:

Your Vote

What do you think of this code (in the Not Given category)?
(The code with your highest vote will win this month's coding contest!)
Excellent  Good  Average  Below Average  Poor (See voting log ...)
 

Other User Comments

8/30/1999 5:19:00 AMIntelliyo

Can i have a done source code of this file ?? Email it to me pls!!!
(If this comment was disrespectful, please report it.)

 
9/6/1999 3:43:00 AMRudy Wieser

Explorer /e,/root, {RootPath}
Explorer n/e,/,root, {RootPath}

Could you explain what those arguments mean ? Or where I could find info about it ...

Thanks.
(If this comment was disrespectful, please report it.)

 
2/15/2000 1:42:01 PMgr33n

Great code. Is there anyway to open a drive like d:\ and still list the other drives?
(If this comment was disrespectful, please report it.)

 
1/9/2001 9:37:26 AMtry this !!!

eRoot "ftp://........./", True
ps: Win98(2) & WinMe
(If this comment was disrespectful, please report it.)

 
5/30/2001 5:43:40 PMMatthew Brown

Sorry, what does this code do... What's the root of Explorer... Is that like 'My Computer' folder or what ever...
(If this comment was disrespectful, please report it.)

 
1/31/2002 3:33:43 AMJeroen

Try it on your console:
explorer /e,c:\progra~1
You explorer will open with the default directory set to c:\Program Files

(If this comment was disrespectful, please report it.)

 
1/31/2002 2:06:02 PMBrian

Excellent! One of those time-saving little things that I've always thought would be nice to do but didn't know where to go to find out how to do it and didn't have the patience to go digging through a thousand websites to find out.
(If this comment was disrespectful, please report it.)

 
5/3/2002 2:30:56 AMalex sirbu

FOR THOSE WHO DON'T KNOW WHAT THOSE ARGUMENTS MEANS:


Explorer Shortcut and Command Line Switches

You can execute Explorer from the command line or from a shortcut and use switches to control the view. The syntax is: EXPLORER.EXE [/n] [/e] [,/root,{object}] [[,/select],{sub object}]
/n.................................Opens a new "My Computer" view of the object, even if already open.
/e.................................Opens an "Explorer" view of the object.
/root,{object}................The specified root for the display. Explorer.exe /e,/root,D:\ will open an "Explorer" view of the D: drive.
/select,{sub object}.......The specified folder or file receives focus.
Explorer.exe /select,C:\WinNT\System32\Regedt32.exe will open a window view of C:\WinNT\System32 and the NT Registry Editor will receive focus. To do the same with an "Explorer" view, Explorer.exe /e,/select,C:\WinNT\System32\Regedt32.exe

(If this comment was disrespectful, please report it.)

 
8/15/2002 11:35:24 PMms2programmer

this isn't api
(If this comment was disrespectful, please report it.)

 
6/18/2003 11:38:30 PM

Can i have a done source code of this
file ?? Email it to me pls!!!
Is there anyway to open a removable
drive like f:\ and still list the other
drives?i need it urgent!
(If this comment was disrespectful, please report it.)

 
1/27/2004 4:57:01 PM

Have you found a way to use explorer to select files / folders and return the list to basic for processing?
(If this comment was disrespectful, please report it.)

 
5/2/2004 10:20:53 PM

Can i have a done source code of this file? Pls
(If this comment was disrespectful, please report it.)

 
5/3/2005 3:00:09 PM

how can i use the computer commands with
visual basic, for example C:\Destop\folders.exe lets say every time i turn on my PC that folder opens,
how can i do that.
(If this comment was disrespectful, please report it.)

 
9/28/2006 9:51:24 AMChandra

thanks mate, excellet.
(If this comment was disrespectful, please report it.)

 
1/10/2008 10:27:36 AMDavid

For the example: Explorer.exe /e,/select,c:\WinNT\System32\Regedt32.exe

The "sub item" regedt32.exe is above the first row, i.e. on the -2 row, you need to scroll a little upwards to see this "focused" file, is there another to see the file w/o scrolling? Thx
(If this comment was disrespectful, please report it.)

 
2/4/2009 12:57:06 AMAsharaf

Best Code, Congrates....
Private Sub Command1_Click()
I can open my folder clicking the button
Thanks a lot
May GOD bless you.
eRoot "C:\Documents and Settings\latheef\Desktop\CPU SPEED IN MHZ", True
End Sub

(If this comment was disrespectful, please report it.)

 

Add Your Feedback
Your feedback will be posted below and an email sent to the author. Please remember that the author was kind enough to share this with you, so any criticisms must be stated politely, or they will be deleted. (For feedback not related to this particular code, please click here instead.)
 

To post feedback, first please login.