Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

A quick one for ya... :) Windows Explorer.

Status
Not open for further replies.

bujin

MIS
Joined
Oct 2, 2000
Messages
144
Location
GB
Hi.

What is the command-line parameter (switch) to get Explorer to start in a different folder, other than C:\?

I'm writing an Access database application which requires a button click to open up Windows in a specific directory. I want to use:

Call Shell("explorer.exe /s:" & pathname)

Where '/s:' is the switch, and pathname is the location of the start-in folder.

Ta.
 
From a command prompt the "/s" refers to subdirectories...I was just looking at the Properties/Shortcut tab for my Explorer icon and it reads in the Target line: "C:\WINDOWS\EXPLORER.EXE /n,/e,C:\" (minus quotes of course). I changed it to D:\ (my CD drive), ran it, and it gave me a "Drive not ready" error, which is OK 'cause there's no CD in it...anyhow, that might be a place to start...something like "C:\Windows\Explorer.exe N:\nnnnnnnn" (where N:\nnnnnnnn is the drive and folder you want it to start in). You are executing this from within Windows I take it...if you are the "call" statement doesn't work...it will only execute at the DOS level, i.e., at boot time. I hope this helps you a little...:-)
 
Thanks for your reply. I've found the answer (on MS knowledgebase). The switch I was looking for is

/select,X:\FolderName\FileName

So the VB line now reads:

Call Shell("explorer.exe /select," & PathName, 1)

and it works fine.

I am executing this statement from within an Access database using Visual Basic (hence the Call statement).
 
OK man...thanks for the good info...that was something I didn't know.

Have a good day................:-)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top