Jump to content

Need to open explorer to folder in "My Documents" via command line


Recommended Posts

Guest Ralph Malph
Posted

I need to be able to open an explorer window showing a folder found in the

users "My Documents" folder. I need to do this via a .bat file. I know I can

use variable like %userprofile% to find the users profile folder under

"Documents and Settings" but on some of the systems where I need this

function "My Documents" will not be found under "Documents and Settings". For

example I have several PCs where it is found at the root of drive U. (A

thawed part of a frozen computer). Whether "My Documents" is found in a

profile folder under "Documents and Settings" or ANY OTHER place on the

system I need to be able to have an explorer window open up to it. I am

currently using the following line in a .bat file, but it only works if My

Documents is under the users profile folder which is not always the case.

 

%windir%\explorer.exe "%userprofile%\my documents\AXIS Media Control -

Recordings"

 

How can I write a simple script/.bat/cmd file that, no matter who is logged

on or where they have their "My Documents" folder at I can open an explorer

window to a specific folder in it. I also need this to work even if they

change their "My Documents" folder location via right clicking on the "My

Documents" icon and via its properties windows changing its location. Word

and other programs can deal with this so there must be a way unless Microsoft

had another one of their all to often MBD (Microsoft being dumb) days when

designing this part of the system.

 

Thanks for the help,

 

Ralph Malph

  • Replies 1
  • Created
  • Last Reply

Popular Days

Guest Anteaus
Posted

RE: Need to open explorer to folder in "My Documents" via command line

 

Using Autoit from http://www.autoitscript.com:

 

Run("explorer.exe " & @MyDocumentsDir)

 

Note the space after '.exe '

 

"Ralph Malph" wrote:

> I need to be able to open an explorer window showing a folder found in the

> users "My Documents" folder.


×
×
  • Create New...