none
wshShell.ExpandEnvironmentStrings(%programfiles%)

    Question

  • I have installed windows 7 in spanish. For %programfiles% I obtain c:\program files. But in spahis vbscipt only know c:\Archivos de programa. When i make a set in DOS, Windows show me %programfiles%=c:\Program files. But if i show the disk c: apears as c:\Archivos de Programa. them my script to manage files do no execute right. I can i manage enviroment varibles in diferen language instalations. thanks.

     

    Wednesday, March 30, 2011 4:20 PM

Answers

  • This is what I suspected: You have a physical directory called
    c:\Program Files
    and you have a junction called
    c:\Archivos de programa
    which points to c:\Program Files. Microsoft uses this approach to provide compatibility with older programs that look for files in c:\Archivos de programa in the Spanish version of Windows.

    If Tom's suggestion fails to work then I suggest you use the folder c:\Program Files in your scripts. It will always work.

    Thursday, March 31, 2011 7:07 PM

All replies

  • Execute the following command in a Command Prompt (which you call DOS):

    dir  /a  %SystemDrive%\  >  "%UserProfile%\Desktop\dir.txt"

    Now open the desktop file dir.txt and paste it into your reply.

    Wednesday, March 30, 2011 4:37 PM
  • here you have it.

    ALLUSERSPROFILE=C:\ProgramData
    APPDATA=C:\Users\adminjulian\AppData\Roaming
    CommonProgramFiles=C:\Program Files\Common Files
    COMPUTERNAME=FJTENDEROP
    ComSpec=C:\Windows\system32\cmd.exe
    DEFLOGDIR=C:\ProgramData\McAfee\DesktopProtection
    FP_NO_HOST_CHECK=NO
    LOCALAPPDATA=C:\Users\adminjulian\AppData\Local
    NUMBER_OF_PROCESSORS=2
    OS=Windows_NT
    Path=C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\
    PATHEXT=.COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.MSC
    PROCESSOR_ARCHITECTURE=x86
    PROCESSOR_IDENTIFIER=x86 Family 6 Model 23 Stepping 6, GenuineIntel
    PROCESSOR_LEVEL=6
    PROCESSOR_REVISION=1706
    ProgramData=C:\ProgramData
    ProgramFiles=C:\Program Files
    PROMPT=$P$G
    PSModulePath=C:\Windows\system32\WindowsPowerShell\v1.0\Modules\
    PUBLIC=C:\Users\Public
    SystemDrive=C:
    SystemRoot=C:\Windows
    TEMP=C:\Users\ADMINJ~1\AppData\Local\Temp
    TMP=C:\Users\ADMINJ~1\AppData\Local\Temp
    USERDNSDOMAIN=T<<hidden>>.ES
    USERDOMAIN=<<hidden>
    USERNAME=adminjulian
    USERPROFILE=C:\Users\adminjulian
    VSEDEFLOGDIR=C:\ProgramData\McAfee\DesktopProtection
    windir=C:\Windows
    windows_tracing_flags=3
    windows_tracing_logfile=C:\BVTBin\Tests\installpackage\csilogfile.log

    EOF-

    If in DOS i write:

    echo %programfiles% i obtain c:\Program files

    My Windows seve was installed in Spanish, them Program files  translated to spanish is Archivos de Programa

    if you open the explorer files and view the fordesrs in the disk c: you will view the folder c:\Program files trasnlated to spanish. You will view c:\Archivos de Programa.

    If you look the adress bar, the path is translate to spanish. When you put the pointer of the mouse on adress bar. The path change, them will apear in english.

    My script fails. because the enviromente varialble %programfiles% say me Program Files in english.

     

    -->


    Set objFso = CreateObject("scripting.filesystemobject")
    Set objShell = WScript.CreateObject("WScript.Shell")

    'Creo el manejador para el fichero de log.

     

    arrListaFicheros(0)="a.inf"
    arrListaFicheros(1)="b.dll"
    arrListaFicheros(2)="c.dll"
    arrListaFicheros(3)="msvcp60.dll"
    arrListaFicheros(4)="msvcrt.dll"
    arrListaFicheros(5)="xadessign.dll"
    arrListaFicheros(6)="xerces-c_2_6.dll"
    arrListaFicheros(7)="xsec_1_2_1a.dll"

    strSystem32=objShell.ExpandEnvironmentStrings("%Windir%")
    strSystem32=strSystem32+"\System32\"


    strRutaLocal=objShell.ExpandEnvironmentStrings("%ProgramFiles%")
    strRutaLocal=strRutaLocal & "\Portafirmas"



    if Not objFso.FolderExists(strRutaLocal) Then
     objFSO.CreateFolder strRutaLocal
    End If


    strRutaLocal=strRutaLocal+"\"


    For i=0 To UBound(arrListaFicheros)-1
     If Not objFso.FileExists(strRutaLocal+arrListaFicheros(i)) Then
      objFso.CopyFile strRepositorio + arrListaFicheros(i), strRutaLocal
      bolCopiadoFicheros=True  '-- Se han copiado ficheros nuevos.
     End If
    Next

    If bolCopiadoFicheros Then

     strCmd1=strSystem32 + "regsvr32.exe /s "+ Chr(34) + strRutaLocal + "a.dll"+ Chr(34)
     strCmd2=strSystem32 + "regsvr32.exe /s "+ Chr(34) + strRutaLocal + "b.dll"+ Chr(34)
     objShell.Run(strCmd1),1,True
     objShell.Run(strCmd2),1,True
    End If

    ->>

     

    thanks for help me.

    I was think that pearhaps is betther as first for the language of the SO. And them forget the enviroment variables.

    Sorry by my english.

     

    Thursday, March 31, 2011 9:05 AM
  • You might try the Shell.Application objects Namespace function with a special folder constant to see if it deliverers the information in the appropriate locale language ...

      Set objShell = CreateObject("Shell.Application")
      Set objFolder = objShell.Namespace(hSpecialFolderConstant)

    where the special folder constant for Program Files is &H26& (38 decimal).  To get the path, use ...

      sProgFilesPath = objFolder.self.Path


    Tom Lavedas
    Thursday, March 31, 2011 1:34 PM
  • I was asking for the output from this command:

    dir  /a  %SystemDrive%\  >  "%UserProfile%\Desktop\dir.txt"

    In your reply you posted the output from this command:

    set  >  "%UserProfile%\Desktop\dir.txt"

    For what I had in mind I really need the correct command.

    Thursday, March 31, 2011 4:57 PM
  • Correct for peagasus. i have writed you SET command from DOS. You ask me DIR /A

    Excuse me.

    here you have.

     Directorio de C:\

    11/01/2011  11:34    <DIR>          $RECYCLE.BIN
    05/01/2011  09:13    <JUNCTION>     Archivos de programa [C:\Program Files]
    10/06/2009  23:42                24 autoexec.bat
    25/07/2009  15:42             8.192 BOOTSECT.BAK
    20/03/2007  12:19         9.634.614 calderon.bmp
    10/06/2009  23:42                10 config.sys
    31/03/2011  19:48                 0 dir_a.txt
    14/07/2009  06:53    <JUNCTION>     Documents and Settings [C:\Users]
    03/01/2011  15:21    <DIR>          DRAE
    28/03/2011  09:33    <DIR>          fotos
    28/03/2011  09:17     2.786.521.088 hiberfil.sys
    11/03/2011  12:39    <DIR>          HP
    03/01/2011  15:20                 0 IO.SYS
    28/03/2011  09:32    <DIR>          mp4
    03/01/2011  15:20                 0 MSDOS.SYS
    03/01/2011  14:45    <DIR>          MSOCache
    17/12/2010  06:09                 0 OS
    28/03/2011  09:17     3.715.362.816 pagefile.sys
    23/03/2011  10:32    <DIR>          Pelis
    14/07/2009  04:37    <DIR>          PerfLogs
    25/02/2011  15:53    <DIR>          Program Files
    25/02/2011  15:54    <DIR>          ProgramData
    14/02/2011  16:22    <DIR>          Quarantine
    25/07/2009  14:54    <DIR>          Recovery
    11/08/2010  11:34            69.390 spain-campeones.jpg
    03/01/2011  12:35    <DIR>          SWSETUP
    31/03/2011  02:34    <DIR>          System Volume Information
    03/01/2011  12:35    <DIR>          SYSTEM.SAV
    31/03/2011  19:47    <DIR>          Users
    03/01/2011  12:31    <DIR>          WARRANTY
    31/03/2011  19:47    <DIR>          Windows
    03/01/2011  16:49    <DIR>          WINZIP
    24/01/2011  16:33    <DIR>          zebra wxp
                  11 archivos  6.511.596.134 bytes
                  22 dirs  443.828.199.424 bytes libres

    Them i am working in the line of Tom Lavedas. He have open my mind. But now need study the Shell.Aplication, to give him a request.

    Thanks for you interest.

     

    Thursday, March 31, 2011 5:51 PM
  • This is what I suspected: You have a physical directory called
    c:\Program Files
    and you have a junction called
    c:\Archivos de programa
    which points to c:\Program Files. Microsoft uses this approach to provide compatibility with older programs that look for files in c:\Archivos de programa in the Spanish version of Windows.

    If Tom's suggestion fails to work then I suggest you use the folder c:\Program Files in your scripts. It will always work.

    Thursday, March 31, 2011 7:07 PM