Jump to content

ElDiabl0

Member
  • Posts

    2
  • Joined

  • Last visited

  • Donations

    0.00 USD 
  • Country

    Brazil

Everything posted by ElDiabl0

  1. I cant really add one variable for each WinXP locale and the 'Common AppData' folder may also be stored on another location. Edit: Just realized what you meant, and yes, extracting to %7zSfxFolder35% is a lot better than what I was doing. Question, can I run a cmd command to kill a process BEFORE extracting the files to InstallPath=?
  2. I'm at a loss on how to extract something to C:\ProgramData\ on Vista/7 or "C:\Documents and Settings\All Users\Application Data\" on XP. I do know the path is stored in HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders (the entry which contains the path is 'Common AppData') But if I do a reg query and attempt to copy the file to the location I got from the registry, the environment variable isn't converted to a path, so instead of copying the files to "C:\ProgramData\" the batch will consider "%ProgramData%" as a folder name instead of a variable. The same happens on XP, except the default value of the entry is "%ALLUSERSPROFILE%\Application Data" I haven't found a way to reparse the variable to get the actual path. This is what I'm using to query the registry FOR /F "tokens=3* delims= " %%A IN ('REG QUERY "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders" /v "Common AppData"') DO SET extractpath=%%B What I need is a way to reparse %extractpath% to get the full path instead of the environment variable. The reason I can't just type the path on the SFX config is because it needs to work on every Windows locale and it also needs to work whether the value of "Common AppData" is the default or not. Edit: Nevermind. I can get the full path from "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders" Anyone looking for something similar this is what I've come up with. Not sure if it's the easiest/best option but... RunProgram="hidcon:cmd /C FOR /f \"tokens=3*\" %a IN ('REG QUERY \"HKLM\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Shell Folders\" /v \"Common Appdata\" ^| findstr /c:\"Common Appdata\"') DO XCOPY \"%temp%\\Whatever_folder_or_file_Im_copying" \"%b\\Folder\" /H /E /Y" The above code will copy something from "%temp%\Whatever_folder_or_file_Im_copying" to "C:\ProgramData\Folder" on Windows Vista or newer. On XP/2k3 it will copy from "%temp%\Whatever_folder_or_file_Im_copying" to "C:\Documents and Settings\All Users\Application Data\Folder" or the equivalent 'Common AppData' folder on non-english versions of Windows.
×
×
  • Create New...