environmental variable

G

Guest

Does anybody know the environmental variable for the files system directories
to get the path of: C:\Documents and Settings\username\Start Menu\Programs.

This typical path is good for Windows engl version, but the folders have
different names in a french or polish version. Therefore I am looking for a
shell script or environmental variable or a Constant to be used in different
language versions of Windows.

Can anybody give an input ?
thanks
Friedi
 
G

GTS

%ProgramFiles% I don't know if this would be the same in non-English
versions though.
BTW, you should not assume a C drive letter for English versions.
 
D

David Candy

There isn't one. One normally asks windows what is the file path using ShGetSpecialFolder or varients.
 
G

GTS

Correction - I misread your post. I see you want user programs not all
users. FWIW, In English Windows that would be
"%HOMEDRIVE%%HOMEPATH%\Start Menu\Programs"
--
 
G

Guest

Thanks for your answer, but I need the path for \Start Menu\Programs.
In the polish version of windows this would be \Menu Start\Programy
In the french version, it would be different too - so I am looking for a
constante or variable to give me the path to \Start Menu\Programs for any
language version.
 
T

Torgeir Bakken \(MVP\)

Friedi said:
Does anybody know the environmental variable for the files
system directories to get the path of: C:\Documents and
Settings\username\Start Menu\Programs.

This typical path is good for Windows engl version, but the
folders have different names in a french or polish version.
Therefore I am looking for a shell script or environmental
variable or a Constant to be used in different language
versions of Windows.

Can anybody give an input ?
Hi,

Read out the data in the registry value "Programs" under
HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer
\Shell Folders\


As long as you haven't redirected the user profile folder away from
the system drive, this batch file that uses reg.exe (that comes
builtin with WinXP) should work for you:

--------------------8<----------------------
@echo off
setlocal
set rkey="HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders"
set rvalue="Programs"
set regexe=%SystemRoot%\System32\Reg.exe
:: line above for command (line might wrap)
for /f "Skip=4 Tokens=2 Delims=:" %%a in ('%regexe% QUERY %rkey% /v %rvalue%') do set rdata=%%a
:: line under for command
set ProgramsMenu=%SystemDrive%%rdata%

echo %ProgramsMenu%

pause
endlocal
--------------------8<----------------------



If you have redirected the user profile, or you need to support
Windows 2000 computers as well, use this batch file that creates a
VBScript on the fly that obtains the value:

--------------------8<----------------------
@echo off
setlocal
set tmpfile="%tmp%\pp.vbs"
echo Set oSh = CreateObject("WScript.Shell") >%tmpfile%
echo WScript.Echo oSh.RegRead("HKCU\Software\Microsoft\" _ >>%tmpfile%
echo ^& "Windows\CurrentVersion\Explorer\Shell Folders\Programs") >>%tmpfile%

for /f "tokens=*" %%a in (
'cscript.exe //Nologo %tmpfile%') do set ProgramsMenu=%%a
del %tmpfile%

echo %ProgramsMenu%

pause
endlocal
--------------------8<----------------------
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top