Jump to content

Recommended Posts


Posted (edited)

no there is not however you should be able to in most cases use %userprofile%\My Documents\

note: to get a list of enviroment variables type set into a command prompt

Edited by spazmire11
Posted

No, you have to look in HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders\Personal to determine the location.

Posted

Here's how to do with a batch file :

@echo off

verify other 2>nul

setlocal enableextensions

if errorlevel 1 (echo error : setlocal failed&goto :eof)

rem TAKE CARE : the whitespace after delims= is ONE TAB plus ONE SPACE, in that order, and there is only one line until the next green text

for /f "skip=4 tokens=1,2,* delims= " %%l in ('reg query "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders" /v "Personal"') do (set MyDocs=%%n)

rem do something with that value HERE and not elsewhere

rem for example :

copy c:\windows\winamp.ini "%MyDocs%\winamp_backup.ini"

echo Winamp.ini saved into %MyDocs%

rem since i used setlocal to enable the "command extensions", all env vars are local to this batch

rem so they will be deleted when the batch ends, or when the endlocal command is called

rem the two next lines show you the problem : "MyDocs" is now empty...

endlocal

echo MyDocs=%MyDocs%

:eof

Posted

I find the Shell Folders key more successful, however in an unattended install, I am unsure as to when the USF key maps to it:

FOR /F "TOKENS=3* DELIMS=	" %%? IN ('REG QUERY "HKCU\SOFTWARE\MICROSOFT\WINDOWS\CURRENTVERSION\EXPLORER\SHELL FOLDERS" /V PERSONAL^|FIND ":\"') DO (SET MYDOCS=%%?)

Where DELIMS=<tab>"

Posted

Here is a VBS Script for My Documents

Const MY_DOCUMENTS = &H5&
Dim Act, MyDoc, MyDocPath
Set Act = CreateObject("Shell.Application")
Set MyDocPath = Act.Namespace(MY_DOCUMENTS)
Set MyDoc = MyDocPath.Self
MsgBox MyDoc.Path, 0 + 32, "My Docsuments"

Posted (edited)
Here is a VBS Script for My Documents
Const MY_DOCUMENTS = &H5&
Dim Act, MyDoc, MyDocPath
Set Act = CreateObject("Shell.Application")
Set MyDocPath = Act.Namespace(MY_DOCUMENTS)
Set MyDoc = MyDocPath.Self
MsgBox MyDoc.Path, 0 + 32, "My Docsuments"

Thanks GUNS'! :thumbup

Edited by Mercury_22
Posted

I am not sure what language that is but in VBS it would be this

VBS

Const MY_DOCUMENTS = &H5&
Dim Act, MyDoc, MyDocPath
Set Act = CreateObject("Shell.Application")
Set MyDocPath = Act.Namespace(MY_DOCUMENTS)
Set MyDoc = MyDocPath.Self
Act.Run(chr(34) & MyDoc & "\FILENAME_HERE" & chr(34)),1,True

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...