Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Need to find "My Documents" via DOS command line variable or other

1,060 views
Skip to first unread message

Ralph Malph

unread,
Oct 17, 2008, 2:42:15 PM10/17/08
to

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

Zaphod Beeblebrox

unread,
Oct 20, 2008, 8:28:39 AM10/20/08
to

"Ralph Malph" <ralph...@happydays.com> wrote in message
news:AD474710-68D6-4440...@microsoft.com...

Even though you posted in microsoft.public.win3x_wfw_dos I suspect your
OS is rather more modern. It would help to know what OS your users are
using. Also, you may find more help in alt.msdos.batch (for DOS / Win9x
/ WinME) or alt.msdos.batch.nt (for WinNT / Win2K / WinXP).

To get you started, look at the output of:

reg query "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\User
Shell Folders" /v personal

or

reg query "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Shell
Folders" /v personal

I'm not sure which one actually points to My Documents in a system where
it has been moved from the default, but a brief experiment should reveal
it. That, along with an output parser like "find" or "for /F" or
similar should allow extraction of the desired directory.
Unfortunately, I'm not expert in using those tools, but the folks in
a.m.b / a.m.b.n are.

Good luck!

--
Zaphod

Zaphod's just zis guy, ya know?


<UNKNOWN>

unread,
Dec 20, 2008, 9:36:32 AM12/20/08
to

"Ralph Malph" <ralph...@happydays.com> wrote in message
news:AD474710-68D6-4440...@microsoft.com...
>

ericap...@gmail.com

unread,
Jan 18, 2015, 8:53:13 AM1/18/15
to
Buy your high quality real or fake passport,(fani...@gmail.com) Counterfeit Bills,Real and Fake Driver's licenses, ID cards, visas, stamps, diploma, certificates, degrees, citizenship and other products for a number of countries like: USA, Australia, Belgium, Brazil, Canada, Italy, Finland, France, Germany, Israel, Russia,Mexico, Finland,Netherlands ,South Africa,Spain,United Kingdom.Japan when producing; magnetic encoded strips and/or scan able bar-code. UV-spectrum analysis test standards,magnetic strip,

Watch video here for more details........... http://vimeo.com/82973635

Contact us............... fani...@gmail.com

Email.......................... fani...@yahoo.com

SKYPE US for quick chat ................. fandena.fandena

SKYPE US for quick chat ................. fandena.fandena

SKYPE US for quick chat ................. fandena.fandena

Contact e-mails: fani...@gmail.com Technical support: fani...@gmail.com
0 new messages