7zsd.sfx / 7zSD_En.CHM: Undocumented Features

Questions or comments on the switchless installers? Want to create a new one? Talk about it here.
User avatar
mooms
Posts: 712
Joined: Wed Aug 27, 2008 1:29 pm
Location: France

Post by mooms » Sun Feb 24, 2013 11:02 am

Hello,

Using the new lang parameter, I want to make a config file for CCleaner that will install it in the correct language according to system locale.

This example works well:

Code: Select all

;!@Install@!UTF-8!
GUIMode="2"
RunProgram="ccsetup.exe /S"
;!@InstallEnd@!

;!@Install@!UTF-8:Language:1036!
GUIMode="2"
RunProgram=-
RunProgram="ccsetup.exe /S /L=1036"
;!@InstallEnd@:Language:1036!
If French system is detected, it will run "ccsetup.exe /S /L=1036", in all other cases, it will run "ccsetup.exe /S" (CCleaner will be in English on first start).

CCleaner have support for 47 languages, so, if I want to create a true international sfx, can i use some variables in the config file, or must I create every lcid variable in the config file ?

I'm thinking of something like RunProgram="ccsetup.exe /S /L=%lang%"

Edit: maybe I can use this command in batch: wmic OS get OSLanguage but I'm a newb in batch syntax and I don't know how to retrieve the result and insert the variable after....

User avatar
gora
Posts: 150
Joined: Wed Nov 07, 2007 7:33 am
Location: Ivanovo, Russia

Post by gora » Sun Feb 24, 2013 11:29 am

Code: Select all

;!@Install@!UTF-8! 
SetEnvironment="Lang=1033"
GUIMode="2"
RunProgram="ccsetup.exe /S /L=%Lang%"
;!@InstallEnd@!

;!@Install@!UTF-8:Language:1036!
SetEnvironment="Lang=1036"
;!@InstallEnd@:Language:1036!

;!@Install@!UTF-8:Language:1049!
SetEnvironment="Lang=1049"
;!@InstallEnd@:Language:1049!

;!@Install@!UTF-8:Language:1058!
SetEnvironment="Lang=1058"
;!@InstallEnd@:Language:1058!

User avatar
mooms
Posts: 712
Joined: Wed Aug 27, 2008 1:29 pm
Location: France

Post by mooms » Sun Feb 24, 2013 1:14 pm

Thanks gora, it's a bit better, but with this we still have to manually add the 47 supported languages in the config file.
Do you know a way to retrieve the lcid and inject it in a variable ?

This works (in a cmd file):

Code: Select all

for /f  "delims=" %%i in ('wmic os get oslanguage') do echo %%i
But the returned result is on 3 lines, so the result in line 2 is always overwritten by the third line which is empty.
I have great difficulty with batch syntax

User avatar
gora
Posts: 150
Joined: Wed Nov 07, 2007 7:33 am
Location: Ivanovo, Russia

Post by gora » Sun Feb 24, 2013 1:53 pm

Code: Select all

;!@Install@!UTF-8! 
RunProgram="hidcom:cmd /c For /f \"skip=1\" %i In ('wmic os get oslanguage') Do ccsetup.exe /S /L=%i & Exit" 
GUIMode="2" 
;!@InstallEnd@! 
Last edited by gora on Sun Mar 24, 2013 10:11 am, edited 1 time in total.

User avatar
ricktendo64
Posts: 3212
Joined: Mon May 22, 2006 12:27 am
Location: Honduras

Post by ricktendo64 » Sun Feb 24, 2013 2:26 pm

Gora, 1033 will work on en-US but will it be called for en-GB and the other English Locale ID values? Does one have to specify each oslanguage?

Code: Select all

English	Australia	3081
English	Belize	10249
English	Canada	4105
English	Caribbean	9225
English	Ireland	6153
English	Jamaica	8201
English	New Zealand	5129
English	Republic of the Philippines	13321
English	South Africa	7177
English	Trinidad and Tobago	11273
English	United Kingdom	2057
English

(Default English Locale ID)
	United States	1033
English	Zimbabwe	12297
Will the hex values work?

Code: Select all

; 0436 is the language ID for Afrikaans
[Strings.0436]

; 041C is the language ID for Albanian
[Strings.041C]

; 1401 is the language ID for Arabic - Algeria
[Strings.1401]

; 3C01 is the language ID for Arabic - Bahrain
[Strings.3C01]

; 0C01 is the language ID for Arabic - Egypt
[Strings.0C01]

; 0801 is the language ID for Arabic - Iraq
[Strings.0801]

; 2C01 is the language ID for Arabic - Jordan
[Strings.2C01]

; 3401 is the language ID for Arabic - Kuwait
[Strings.3401]

; 3001 is the language ID for Arabic - Lebanon
[Strings.3001]

; 1001 is the language ID for Arabic - Libya
[Strings.1001]

; 1801 is the language ID for Arabic - Morocco
[Strings.1801]

; 2001 is the language ID for Arabic - Oman
[Strings.2001]

; 4001 is the language ID for Arabic - Qatar
[Strings.4001]

; 0401 is the language ID for Arabic - Saudi Arabia
[Strings.0401]

; 2801 is the language ID for Arabic - Syria
[Strings.2801]

; 1C01 is the language ID for Arabic - Tunisia
[Strings.1C01]

; 3801 is the language ID for Arabic - United Arab Emirates
[Strings.3801]

; 2401 is the language ID for Arabic - Yemen
[Strings.2401]

; 042B is the language ID for Armenian
[Strings.042B]

; 082C is the language ID for Azeri - Cyrillic
[Strings.082C]

; 042C is the language ID for Azeri - Latin
[Strings.042C]

; 042D is the language ID for Basque
[Strings.042D]

; 0423 is the language ID for Belarusian
[Strings.0423]

; 0402 is the language ID for Bulgarian
[Strings.0402]

; 0403 is the language ID for Catalan
[Strings.0403]

; 0804 is the language ID for Chinese - China
[Strings.0804]

; 0C04 is the language ID for Chinese - Hong Kong SAR
[Strings.0C04]

; 1404 is the language ID for Chinese - Macau SAR
[Strings.1404]

; 1004 is the language ID for Chinese - Singapore
[Strings.1004]

; 0404 is the language ID for Chinese - Taiwan
[Strings.0404]

; 041A is the language ID for Croatian
[Strings.041A]

; 0405 is the language ID for Czech
[Strings.0405]

; 0405 is the language ID for Danish
[Strings.0406]

; 0813 is the language ID for Dutch - Belgium
[Strings.0813]

; 0413 is the language ID for Dutch - Netherlands
[Strings.0413]

; 0C09 is the language ID for English - Australia
[Strings.0C09]

; 2809 is the language ID for English - Belize
[Strings.2809]

; 1009 is the language ID for English - Canada
[Strings.1009]

; 2409 is the language ID for English - Caribbean
[Strings.2409]

; 0809 is the language ID for English - United Kingdom
[Strings.0809]

; 1809 is the language ID for English - Ireland
[Strings.1809]

; 2009 is the language ID for English - Jamaica
[Strings.2009]

; 1409 is the language ID for English - New Zealand
[Strings.1409]

; 3409 is the language ID for English - Phillippines
[Strings.3409]

; 2C09 is the language ID for English - Trinidad
[Strings.2C09]

; 0409 is the language ID for English - United States
[Strings.0409]

; 1C09 is the language ID for English - South Africa
[Strings.1C09]

; 0425 is the language ID for Estonian
[Strings.0425]

; 0438 is the language ID for Faroese
[Strings.0438]

; 0429 is the language ID for Farsi
[Strings.0429]

; 040B is the language ID for Finnish
[Strings.040B]

; 0C0C is the language ID for French - Canada
[Strings.0C0C]

; 100C is the language ID for French - Switzerland
[Strings.100C]

; 040C is the language ID for French - France
[Strings.040C]

; 140C is the language ID for French - Luxembourg
[Strings.140C]

; 083C is the language ID for Gaelic - Ireland
[Strings.083C]

; 043C is the language ID for Gaelic - Scotland
[Strings.043C]

; 0C07 is the language ID for German - Austria
[Strings.0C07]

; 0807 is the language ID for German - Switzerland
[Strings.0807]

; 0407 is the language ID for German - Germany
[Strings.0407]

; 1407 is the language ID for German - Liechtenstein
[Strings.1407]

; 1007 is the language ID for German - Luxembourg
[Strings.1007]

; 0408 is the language ID for Greek
[Strings.0408]

; 040D is the language ID for Hebrew
[Strings.040D]

; 0439 is the language ID for Hindi
[Strings.0439]

; 040E is the language ID for Hungarian
[Strings.040E]

; 040F is the language ID for Icelandic
[Strings.040F]

; 0421 is the language ID for Indonesian
[Strings.0421]

; 0810 is the language ID for Italian - Switzerland
[Strings.0810]

; 0410 is the language ID for Italian - Italy
[Strings.0410]

; 0411 is the language ID for Japanese
[Strings.0411]

; 0412 is the language ID for Korean
[Strings.0412]

; 0426 is the language ID for Latvian
[Strings.0426]

; 0427 is the language ID for Lithuanian
[Strings.0427]

; 042F is the language ID for Macedonian (FYROM)
[Strings.042F]

; 083E is the language ID for Malay – Brunei
[Strings.083E]

; 043E is the language ID for Malay - Malaysia
[Strings.043E]

; 043A is the language ID for Maltese
[Strings.043A]

; 044E is the language ID for Marathi
[Strings.044E]

; 0414 is the language ID for Norwegian - Bokml
[Strings.0414]

; 0814 is the language ID for Norwegian - Nynorsk
[Strings.0814]

; 0415 is the language ID for Polish
[Strings.0415]

; 0416 is the language ID for Portuguese - Brazil
[Strings.0416]

; 0816 is the language ID for Portuguese - Portugal
[Strings.0816]

; 0417 is the language ID for Raeto-Romance
[Strings.0417]

; 0818 is the language ID for Romanian - Republic of Moldova
[Strings.0818]

; 0418 is the language ID for Romanian - Romania
[Strings.0418]

; 0419 is the language ID for Russian
[Strings.0419]

; 0819 is the language ID for Russian - Republic of Moldova
[Strings.0819]

; 044F is the language ID for Sanskrit
[Strings.044F]

; 0C1A is the language ID for Serbian - Cyrillic
[Strings.0C1A]

; 081A is the language ID for Serbian - Latin
[Strings.081A]

; 0432 is the language ID for Setsuana
[Strings.0432]

; 041B is the language ID for Slovak
[Strings.041B]

; 0424 is the language ID for Slovenian
[Strings.0424]

; 042E is the language ID for Sorbian
[Strings.042E]

; 2C0A is the language ID for Spanish - Argentina
[Strings.2C0A]

; 400A is the language ID for Spanish - Bolivia
[Strings.400A]

; 340A is the language ID for Spanish - Chile
[Strings.340A]

; 240A is the language ID for Spanish - Colombia
[Strings.240A]

; 140A is the language ID for Spanish - Costa Rica
[Strings.140A]

; 1C0A is the language ID for Spanish - Dominican Republic
[Strings.1C0A]

; 300A is the language ID for Spanish - Ecuador
[Strings.300A]

; 0C0A is the language ID for Spanish - Spain
[Strings.0C0A]

; 100A is the language ID for Spanish - Guatemala
[Strings.100A]

; 480A is the language ID for Spanish - Honduras
[Strings.480A]

; 080A is the language ID for Spanish - Mexico
[Strings.080A]

; 4C0A is the language ID for Spanish - Nicaragua
[Strings.4C0A]

; 180A is the language ID for Spanish - Panama
[Strings.180A]

; 280A is the language ID for Spanish - Peru
[Strings.280A]

; 500A is the language ID for Spanish - Puerto Rico
[Strings.500A]

; 3C0A is the language ID for Spanish - Paraguay
[Strings.3C0A]

; 440A is the language ID for Spanish - El Salvador
[Strings.440A]

; 380A is the language ID for Spanish - Uruguay
[Strings.380A]

; 200A is the language ID for Spanish - Venezuela
[Strings.200A]

; 0441 is the language ID for Swahili
[Strings.0441]

; 081D is the language ID for Swedish - Finland
[Strings.081D]

; 041D is the language ID for Swedish - Sweden
[Strings.041D]

; 0430 is the language ID for Southern Sotho
[Strings.0430]

; 0449 is the language ID for Tamil
[Strings.0449]

; 0444 is the language ID for Tatar
[Strings.0444]

; 041E is the language ID for Thai
[Strings.041E]

; 0431 is the language ID for Tsonga
[Strings.0431]

; 041F is the language ID for Turkish
[Strings.041F]

; 0422 is the language ID for Ukrainian
[Strings.0422]

; 0420 is the language ID for Urdu
[Strings.0420]

; 0843 is the language ID for Uzbek - Cyrillic
[Strings.0843]

; 0443 is the language ID for Uzbek - Latin
[Strings.0443]

; 042A is the language ID for Vietnamese
[Strings.042A]

; 0434 is the language ID for Xhosa
[Strings.0434]

; 043D is the language ID for Yiddish
[Strings.043D]

; 0435 is the language ID for Zulu
[Strings.0435]

User avatar
bphlpt
Posts: 1291
Joined: Sat Apr 19, 2008 1:11 am

Post by bphlpt » Sun Feb 24, 2013 2:55 pm

Here is a slight alteration to gora's code

Code: Select all

;!@Install@!UTF-8! 
RunProgram="hidcom:cmd /c For /f "tokens=2 delims==" %G In ('wmic os get OSLanguage /Value') Do ccsetup.exe /S /L=%G & Exit" 
GUIMode="2" 
;!@InstallEnd@!
which should work just as well. (Just shows how to use the /Value option.)

Cheers and Regards

User avatar
mooms
Posts: 712
Joined: Wed Aug 27, 2008 1:29 pm
Location: France

Post by mooms » Sun Feb 24, 2013 3:08 pm

gora wrote:

Code: Select all

;!@Install@!UTF-8! 
RunProgram="hidcom:cmd /c For /f "skip=1" %i In ('wmic os get oslanguage') Do ccsetup.exe /S /L=%i & Exit" 
GUIMode="2" 
;!@InstallEnd@! 
Thanks gora , but that didn't worked:

Image



ricktendo64 wrote:Gora, 1033 will work on en-US but will it be called for en-GB and the other English Locale ID values? Does one have to specify each oslanguage?

Code: Select all

English	Australia	3081
English	Belize	10249
English	Canada	4105
English	Caribbean	9225
English	Ireland	6153
English	Jamaica	8201
English	New Zealand	5129
English	Republic of the Philippines	13321
English	South Africa	7177
English	Trinidad and Tobago	11273
English	United Kingdom	2057
English

That was also my concern, so I have tried
ccsetup.exe /S /L=4105 and ccsetup.exe /S /L=13321 and they are correctly set in English on first start, so it seems OK.

I've tried with an unsupported lcid, like Dari (048c, 1164) ccsetup.exe /S /L=1164 CCleaner is launched in English, so there is no problem.


bphlpt wrote:Here is a slight alteration to gora's code

Code: Select all

;!@Install@!UTF-8! 
RunProgram="hidcom:cmd /c For /f "tokens=2 delims==" %G In ('wmic os get OSLanguage /Value') Do ccsetup.exe /S /L=%G & Exit" 
GUIMode="2" 
;!@InstallEnd@!
which should work just as well. (Just shows how to use the /Value option.)
Thanks bphlpt, but that didn't work either:
Image

User avatar
ricktendo64
Posts: 3212
Joined: Mon May 22, 2006 12:27 am
Location: Honduras

Post by ricktendo64 » Sun Feb 24, 2013 3:19 pm

Fix the quotes

\" = "
Last edited by ricktendo64 on Sun Feb 24, 2013 3:26 pm, edited 1 time in total.

User avatar
bphlpt
Posts: 1291
Joined: Sat Apr 19, 2008 1:11 am

Post by bphlpt » Sun Feb 24, 2013 3:21 pm

gora and I both ran into the issue of needing to escape the inner quotes around either "skip=1" or "tokens=2 delims==". I'm not that familiar with the syntax of the config file. Is it "skip=1" and "tokens=2 delims==" ??

EDIT: I assume Rick meant "quotes" instead of "commas"
ricktendo64 wrote:Fix the commas

" = "
Cheers and Regards

User avatar
ricktendo64
Posts: 3212
Joined: Mon May 22, 2006 12:27 am
Location: Honduras

Post by ricktendo64 » Sun Feb 24, 2013 3:29 pm

Just because you use 13321 and CCleaner launches in English does not mean it worked, CCleaner will default to English if the number is unrecognized/wrong

Anyway I was not asking about CCleaner, I was refering to the 7zip SFX (trying to make a Intl .net 4.5)

User avatar
mooms
Posts: 712
Joined: Wed Aug 27, 2008 1:29 pm
Location: France

Post by mooms » Sun Feb 24, 2013 6:13 pm

Just because you use 13321 and CCleaner launches in English does not mean it worked, CCleaner will default to English if the number is unrecognized/wrong
Correct, so I've also tried 12300, 2060, 3084 and CCleaner was always launched with the correct settings for the 3: French.


gora and I both ran into the issue of needing to escape the inner quotes around either "skip=1" or "tokens=2 delims==". I'm not that familiar with the syntax of the config file. Is it \"skip=1\" and \"tokens=2 delims==\" ??
It's surely because I don't understand the syntax, but even in command prompt/in batch file, these two commands didn't worked:

Code: Select all

For /f "tokens=2 delims==" %G In ('wmic os get OSLanguage /Value') Do ccsetup.exe /S /L=%G

For /f "skip=1" %i In ('wmic os get oslanguage') Do ccsetup.exe /S /L=%i

User avatar
bphlpt
Posts: 1291
Joined: Sat Apr 19, 2008 1:11 am

Post by bphlpt » Sun Feb 24, 2013 6:57 pm

mooms wrote: It's surely because I don't understand the syntax, but even in command prompt/in batch file, these two commands didn't worked:

Code: Select all

For /f "tokens=2 delims==" %G In ('wmic os get OSLanguage /Value') Do ccsetup.exe /S /L=%G

For /f "skip=1" %i In ('wmic os get oslanguage') Do ccsetup.exe /S /L=%i
If you are trying it in batch mode, then change %G to %%G and %i to %%i.

Using only one "%" is for command line mode.

Me, I don't understand the syntax for config files. :)

Cheers and Regards

User avatar
mooms
Posts: 712
Joined: Wed Aug 27, 2008 1:29 pm
Location: France

Post by mooms » Sun Feb 24, 2013 7:59 pm

The syntax of the modified module seems more simple for me, at least I understand the basics....
Using only one "%" is for command line mode.
That was my mistake indeed.


So here is my findings after adding the missing %:

Code: Select all

For /f "skip=1" %%i In ('wmic os get oslanguage') Do ccsetup.exe /S /L=%%i & Exit"
This works, but it also launch the installer a second time with ccsetup.exe /S /L= so CCleaner will always been in English. Surely a problem with the skip value but I don't know more.

Code: Select all

For /f "tokens=2 delims==" %%G In ('wmic os get OSLanguage /Value') Do ccsetup.exe /S /L=%%G
Works perfectly, so I have tested this command in the config file.



But even with apparently correct syntax (adding a \ before the " (and only keeping one %) it didn't worked....I was a little disappointed...


And, suddenly, :idea: I have found the error, its was a typo ! hidcom instead of hidcon....


I've also discovered it didn't work if launched on XP at T-13 (CCleaner is not installed at all).
Maybe wmic is not available at T-13.
I have added an autoinstall option that will add a RunOnceEx key to address this.

This works perfectly:

Code: Select all

;!@Install@!UTF-8!
GUIMode="2"
RunProgram="hidcon:cmd /c For /f \"tokens=2 delims==\" %G In ('wmic os get OSLanguage /Value') Do ccsetup.exe /S /L=%G"
AutoInstall="hidcon:reg add HKLM\\Software\\Microsoft\\Windows\\CurrentVersion\\RunOnceEx\\ccleaner /ve /d \"CCleaner\" /f"
AutoInstall="hidcon:reg add HKLM\\Software\\Microsoft\\Windows\\CurrentVersion\\RunOnceEx\\ccleaner /v 1 /d %%S\\%%M /f" 
;!@InstallEnd@! 

Just add the switch /ai if you want to run it at T-13 stage of XP setup (svcpack addon)
If the LCID is incorrect/unknown, CCleaner will be launched in English.

Here is the sfx is someone wants to test:
ccleaner_3271900_v5.exe
MD5: 0754efa09283457e83890910c7f95eb8

Many thanks to you three !

User avatar
bphlpt
Posts: 1291
Joined: Sat Apr 19, 2008 1:11 am

Post by bphlpt » Sun Feb 24, 2013 11:44 pm

As a possible alternative to:

Code: Select all

For /f \"tokens=2 delims==\" %G In ('wmic os get OSLanguage /Value')
you might be able to use this which doesn't rely on wmic:

Code: Select all

For /f "tokens=3 delims= " %G In ('reg query "hklm\system\controlset001\control\nls\language" /v Installlanguage')
The only problem is that the reg query returns the LCID in base 16 (Hex) rather than base 10, ie %G will be equal to 0409 instead of 1033 for US English. I also don't know if that value will be set up at T-13, but if it is, and you are able to enter the Hex value in ccsetup.exe, then that might work.

If you need the value to be decimal and not hex, that can be done, but I haven't figured out a way to do it on one line. But it would be trivial to make an external batch program that could return the value in decimal, it would only need to be 3 lines or so, something like this:

Code: Select all

@echo off & Setlocal
For /f "tokens=3 delims= " %%G In ('reg query "hklm\system\controlset001\control\nls\language" /v Installlanguage') Do (Set /a "%1=0x%%G")
Endlocal&Exit /b 0
Save the above as lcid.bat and save it where the config file will be able to access it (probably next to ccsetup.exe). Then I THINK your config file could be written like this?:

Code: Select all

;!@Install@!UTF-8! 
RunProgram="hidcon:cmd /c Call lcid.bat _lcid & ccsetup.exe /S /L=%_lcid% & Exit" 
GUIMode="2" 
;!@InstallEnd@! 
I've tested the batch but not the config file.

Cheers and Regards

User avatar
mooms
Posts: 712
Joined: Wed Aug 27, 2008 1:29 pm
Location: France

Post by mooms » Mon Feb 25, 2013 10:09 am

Why are you using .bat extension instead of .cmd ? there is a particular reason ?

Quickly tested your batch on French Win7 x64, console said something is incorrect , CCleaner is installed but in English.
However, if we integrate a batch file, it is maybe simpler to run the whole thing from the script, only using the sfx to launch the batch.

Anyway, that's just for fun and knowledge, I don't really need other language than French.

AddOn posted here

User avatar
gora
Posts: 150
Joined: Wed Nov 07, 2007 7:33 am
Location: Ivanovo, Russia

Post by gora » Mon Feb 25, 2013 11:17 am

Try this:

Code: Select all

;!@Install@!UTF-8!
RunProgram="hidcon:cmd /c For /f \"tokens=3 delims= \" %G In ('reg query \"hklm\\system\\controlset001\\control\\nls\\language\" /v Installlanguage') Do Set /a _lcid=0x%G & Call ccsetup.exe /S /L=%_lcid%"
GUIMode="2"
;!@InstallEnd@!

User avatar
bphlpt
Posts: 1291
Joined: Sat Apr 19, 2008 1:11 am

Post by bphlpt » Mon Feb 25, 2013 2:58 pm

Thanks gora. I had forgotten about using "Call" to force evaluating the variable again to get around the delayed expansion problem. But, while your syntx seems to work, I would add one more set of quotes in the "Set /a" to make the command meet "specifications". Like this:

Code: Select all

;!@Install@!UTF-8!
RunProgram="hidcon:cmd /c For /f "tokens=3 delims= " %G In ('reg query "hklm\\system\\controlset001\\control\\nls\\language" /v Installlanguage') Do Set /a "_lcid=0x%G" & Call ccsetup.exe /S /L=%_lcid%"
GUIMode="2"
;!@InstallEnd@!
I would hope that will work. mooms, as more of a config file expert than me, you'll just have to try this and see. Since gora thinks it might, that's a strong vote as far as I'm concerned. But remember, I'm not sure whether the registry key will be set correctly at T-13 anyway, but it would be nice to know if it is since this seems to be a very quick and compact way to do this for other projects if it works.

For those wanting to know a little more about batch command syntax, here is a explanation about the delayed expansion issue and the solution implemented above:

From run-two-commands-in-one-windows-cmd-line-one-command-is-set-command:
Q:
<snip>
However, the following command sequence does not run as expected (at least by me):

Code: Select all

C:\Users\Administrator>set name=value & echo %name%
%name%
<snip>
As we can see, the first echo cannot get the environment. Could you help to comment? Any comment will be appreciated!
A:
Your result is due to the fact that %name% is expanded during the parsing phase, and the entire line is parsed at once, prior to the value being set.

You can get the current value on the same line as the set command in one of two ways.

1) use CALL to cause ECHO %NAME% to be parsed a 2nd time:

Code: Select all

set name=value&call echo %name%
Note: your original line had a space before the &, this space would be included in the value of the variable. You can prevent the extra space by using quotes: set "name=value" &...

2) use delayed expansion to get the value at execution time instead of at parse time. Most environments do not have delayed expansion enabled by default. You can enable delayed expansion on the command line by using the appropriate CMD.EXE option.

Code: Select all

cmd /v:on
set "name=value" & echo !name!
Delayed expansion certainly can be used on the command line, but it is more frequently used within a batch file. SETLOCAL is used to enable delayed expansion within a batch file (it does not work from the command line)

Code: Select all

setlocal enableDelayedExpansion
set "name=value" & echo !name!
NOTE: If the first solution above is used in a batch file, escape the %'s with second ones like:

Code: Select all

set name=value&call echo %%name%%
So based on above, this alternative also might work (not tested):

Code: Select all

;!@Install@!UTF-8!
RunProgram="hidcon:cmd /v:on /c For /f "tokens=3 delims= " %G In ('reg query "hklm\\system\\controlset001\\control\\nls\\language" /v Installlanguage') Do Set /a "_lcid=0x%G" & ccsetup.exe /S /L=!_lcid!"
GUIMode="2"
;!@InstallEnd@!

------------------
mooms wrote:Why are you using .bat extension instead of .cmd ? there is a particular reason ?
No, no particular reason. In fact you are correct that I really should almost always use .cmd. (.cmd files won't run with a double click on Win9x family OS, so .bat are preferred/required there.) I have often used them interchangeably when working in NT family OS, since they are both handled by CMD.EXE, but your question made me investigate further and this is what I found:

From windows-batch-files-bat-vs-cmd:
From Wikipedia:

New Quote from Wikipedia
The only known difference between .cmd and .bat file execution is that in a .cmd file the ERRORLEVEL variable changes even on a successful command that is affected by Command Extensions (when Command Extensions are enabled), whereas in .bat files the ERRORLEVEL variable changes only upon errors.
The source for the Wikipedia quote above is actually based on this news group posting.
The differences between .CMD and .BAT as far as CMD.EXE is concerned are: With extensions enabled, PATH/APPEND/PROMPT/SET/ASSOC in .CMD files will set ERRORLEVEL regardless of error. .BAT sets ERRORLEVEL only on errors.
Note only is it a little more restrictive concerning the differences, than the Wikipedia text, but is also worth being explicitly mentioned, given the fact Mark Zbikowski himself - which gives a huge credebility bonus IMHO.
So the difference is very slight, but I should have used .cmd. Thanks for making me look that up.

Cheers and Regards

User avatar
mooms
Posts: 712
Joined: Wed Aug 27, 2008 1:29 pm
Location: France

Post by mooms » Wed Feb 27, 2013 9:04 pm

I have tried your and gora's last config file:
They both failed to install CCleaner in French on Windows XP SP3 French. (Cleaner is installed but in English)

Not tried at T-13 stage obviously.

They both works fine on Win7 x64 French however.


Here is an archive with the two installers and all the needed files to test: http://www.mediafire.com/?hvxbg34kf3r81hv

Tip: you can install CCleaner on top of an other install, you just have to set an other language in CCleaner before starting again the silent install, so you will be able to see if the parameters are working by launching CCleaner again.

User avatar
bphlpt
Posts: 1291
Joined: Sat Apr 19, 2008 1:11 am

Post by bphlpt » Sun Mar 10, 2013 9:10 pm

After a bit of rework, and thanks to further testing by mooms, here are four alternatives to the above that have been shown to work correctly in live versions of both Win7 and XP to automatically install a multi-language install package in the language of the installed OS with no other switch or other interaction from the user required. mooms has also confirmed that the first example works correctly in XP at T-13, and there is no reason to believe the others would not work there as well if you prefer one form over the other.  All four of these should work exactly the same for all versions of Windows from XP through Win8 and 2012.  I would probably use the first alternative just because it seems more "complete" with the extra redirects of any potential error message and I usually like my installs to be silent, and because using the CALL is slightly more natural than invoking the delayed expansion at the command line.  Of course, if the redirects mess up ccsetup in any way, or any other install this method is tried on, or you wish to have further control over the output that is shown to the user, then I would suggest the third alternative form.

Code: Select all

;!@Install@!UTF-8!
RunProgram="hidcon:cmd /c \"FOR /f \"tokens=2*\" %G IN ('reg query \"hklm\\system\\controlset001\\control\\nls\\language\" /v Installlanguage 2^>NUL ^| FIND \"REG_SZ\"') DO SET /a \"_lcid=0x%H\" & CALL ccsetup.exe /S /L=%_lcid%\" >NUL 2>&1"
GUIMode="2"
;!@InstallEnd@!

Code: Select all

;!@Install@!UTF-8!
RunProgram="hidcon:cmd /v:on /c \"FOR /f \"tokens=2*\" %G IN ('reg query \"hklm\\system\\controlset001\\control\\nls\\language\" /v Installlanguage 2^>NUL ^| FIND \"REG_SZ\"') DO SET /a \"_lcid=0x%H\" & ccsetup.exe /S /L=!_lcid!\" >NUL 2>&1"
GUIMode="2"
;!@InstallEnd@!

Code: Select all

;!@Install@!UTF-8!
RunProgram="hidcon:cmd /c \"FOR /f \"tokens=2*\" %G IN ('reg query \"hklm\\system\\controlset001\\control\\nls\\language\" /v Installlanguage ^| FIND \"REG_SZ\"') DO SET /a \"_lcid=0x%H\" & CALL ccsetup.exe /S /L=%_lcid%\""
GUIMode="2"
;!@InstallEnd@!

Code: Select all

;!@Install@!UTF-8!
RunProgram="hidcon:cmd /v:on /c \"FOR /f \"tokens=2*\" %G IN ('reg query \"hklm\\system\\controlset001\\control\\nls\\language\" /v Installlanguage ^| FIND \"REG_SZ\"') DO SET /a \"_lcid=0x%H\" & ccsetup.exe /S /L=!_lcid!\""
GUIMode="2"
;!@InstallEnd@!
 
The required changes from what was tried before were 1) differences in the output of "reg query" in XP vs Win7 required using the 'FIND \"REG_SZ\"', and 2) when you use multiple commands concatenated together with "&" it requires surrounding the combined command in yet another set of quotes.

FYI, if you ever wanted to test these kinds of commands in a "regular" bat/cmd file, the syntax is slightly different, here's how the first two would look (for the other two just delete the error redirects):

Code: Select all

@echo off
cmd /c "FOR /F "tokens=2*" %%G IN ('reg query "hklm\system\controlset001\control\nls\language" /v Installlanguage 2^>NUL ^| FIND "REG_SZ"') Do Set /a "_lcid=0x%%H" & CALL ccsetup.exe /S /L=%%_lcid%%" >NUL 2>&1
pause

Code: Select all

@echo off
cmd /v:on /c "FOR /F "tokens=2*" %%G IN ('reg query "hklm\system\controlset001\control\nls\language" /v Installlanguage 2^>NUL ^| FIND "REG_SZ"') Do Set /a "_lcid=0x%%H" & ccsetup.exe /S /L=!_lcid!" >NUL 2>&1
pause
Cheers and Regards

User avatar
shiner
Posts: 655
Joined: Sun Nov 08, 2009 4:18 am
Location: SE Asia

Post by shiner » Mon Mar 11, 2013 12:14 am

mooms, bphlpt, ricktendo64, and Escorpiom

Hi, you guys are doing a great job using the module for multi-language installs.
mooms wrote:...
Do you know a way to retrieve the lcid and inject it in a variable ?
...
I was too busy in late Feb. - early March to add to tranlation of the Russian version of the 7zSFX HelpManual, but want to let you know that there MAY be a new variable in the module which will grab the language of the target system for you, thus making everything a bit easier.

This is a quote from the "Module Variables" section of 7zSD_RU.chm which has been translated by google:
%SfxVarSystemLanguage% - the user interface language of the operating system is set to XXXX
where XXXX - ID the user interface language (for example, 1049 - for the Russian interface, 1033 - for English, etc.)
As you can see, it is not that clear, but I think it means that %SfxVarSystemLanguage% is the 4-digit language code of the target system (not "is set to".)

I don't know if that means version 1.5.0.2712 has this variable or if it is only in version 1.6.0.2712.
I don't have access to anything with a different language Windows UI to test that variable.
Also, I was expecting gora to perhaps introduce and expand on it and some OTHER new variables that were NOT mentioned in the changelog.
"You can lead a horse to water, but you can't make it drink."

User avatar
ricktendo64
Posts: 3212
Joined: Mon May 22, 2006 12:27 am
Location: Honduras

Post by ricktendo64 » Mon Mar 11, 2013 12:26 am

I tested with latest v1.5 and it did not work

Code: Select all

RunProgram="cmd /c echo %SfxVarSystemLanguage%>%%S\\test.txt"
Off topic: could somebody take a look at this code I use to fix the icon on my card reader on Windows 8?

Code: Select all

cmd /c for /f "tokens=1*" %a in ('reg query "HKLM\SYSTEM\CurrentControlSet\Enum\RISDPTSK\Disk&Ven_Ricoh&Prod_SD/MMCStorage&Rev_1.00" ^| findstr /i RISDPTSK') do reg add "%a\Device Parameters" /v RemovalPolicy /t REG_DWORD /d 3 /f
I have to query the registry to look for what this sub-key name is (it may vary)

HKLM\SYSTEM\ControlSet001\Enum\RISDPTSK\Disk&Ven_Ricoh&Prod_SD/MMCStorage&Rev_1.00\0001
Last edited by ricktendo64 on Mon Mar 11, 2013 12:35 am, edited 2 times in total.

User avatar
shiner
Posts: 655
Joined: Sun Nov 08, 2009 4:18 am
Location: SE Asia

Post by shiner » Mon Mar 11, 2013 12:31 am

Thanks for quick testing that, Rick.

Now you see another reason I am hesitant to translate the manual without testing everything first -- which takes a bit of time.

Hopefully, gora will at least comment on this new section of the Russian Help manual.
"You can lead a horse to water, but you can't make it drink."

User avatar
gora
Posts: 150
Joined: Wed Nov 07, 2007 7:33 am
Location: Ivanovo, Russia

Post by gora » Mon Mar 11, 2013 1:59 am

shiner
You are making a big mistake, that is translated version 1.5.
Need to translate the help for version 1.6. Help is written for version 1.6, and it describes all the features of this particular version.
In my opinion the reliability of version 1.6 is not less reliable than version 1.5.

The new description of the help of all the variables of the module and the conditions for their use are collected on a separate page. Many new variables, many of the variables have changed their names. There is also a configuration file to test all the variables of the module in two languages. (For version 1.6 only!)

Variable %SfxVarSystemLanguage% - there is a new variable in version 1.6 only.
1.6 develop (сборка 2712) 30.12.12
* Ложное сообщение об ошибке "Файл не является 7z архивом!" (gora:forum.oszone.net)

1.6 develop (сборка 2524) 25.06.12
* Разрушение памяти при установке переменных среды модуля (gora:forum.oszone.net)

1.6 develop (сборка 2518) 19.06.12
# Удален префикс 7z в именах всех переменных среды модуля, например, было '7zSfxVarModulePlatform', стало 'SfxVarModulePlatform'

1.6 develop (сборка 2496) 28.05.12
* На запароленных SFX окно ввода пароля выводилось дважды (Valerkan:forum.oszone.net)
* Некорректная работа ключа '-p' (gora:forum.oszone.net)
+ Переменные среды при работе модуля '7zSfxVarModulePlatform', '7zSfxVarSystemPlatform', '7zSfxVarSystemLanguage'
– Переменная среды при работе модуля '7zSfxVarPlatform'



Once again, I suggest you translation help manual FULL (COMPLETELY).
In this case, I promise you to help.

Я постоянно правлю справку, исправляю технические неточности в описаниях параметров, и тот английский перевод справки, который сейчас имеется на сайте, уже давно не соответствует русскому исходному варианту справки. Мне непонятно то упорство, с которым Вы не хотите сделать полный перевод всей справки!? :(
Возможно Вас персонально заинтересует возможность делать запароленные SFX, (Вы знаете, наверное, что я делаю такие в некоторых случаях, например Universal Extractor) ? Если Вы согласитесь сделать ПОЛНЫЙ перевод всей справки модуля на английский язык, то я обещаю Вам, что похлопочу перед Олегом о предоставлении Вам доступа в возможности делать запароленные SFX, и думаю, что он не откажет в этом.
Решение за Вами! Сообщите мне о нем, можно в ПМ.

Selective (кусочно-дырочный) translation, you are now using me categorically reject. I can not verify this free translation.

ricktendo64

I do not have the registry key HKLM\SYSTEM\CurrentControlSet\Enum\RISDPTSK
You can export it to the reg file and link it to check and adjust your line.

User avatar
bphlpt
Posts: 1291
Joined: Sat Apr 19, 2008 1:11 am

Post by bphlpt » Mon Mar 11, 2013 3:03 am

ricktendo64 wrote: Off topic: could somebody take a look at this code I use to fix the icon on my card reader on Windows 8?

Code: Select all

cmd /c for /f "tokens=1*" %a in ('reg query "HKLM\SYSTEM\CurrentControlSet\Enum\RISDPTSK\Disk&Ven_Ricoh&Prod_SD/MMCStorage&Rev_1.00" ^| findstr /i RISDPTSK') do reg add "%a\Device Parameters" /v RemovalPolicy /t REG_DWORD /d 3 /f
I have to query the registry to look for what this sub-key name is (it may vary)

HKLM\SYSTEM\ControlSet001\Enum\RISDPTSK\Disk&Ven_Ricoh&Prod_SD/MMCStorage&Rev_1.00\0001
rick, I don't have that reg key either, "HKLM\SYSTEM\CurrentControlSet\Enum\RISDPTSK", and I'm not sure what you expect %a to be, but after just a first glance, I wonder if the &'s in "Disk&Ven_Ricoh&Prod_SD/MMCStorage&Rev_1.00" need to be escaped? If you do this:

Code: Select all

cmd /c for /f "tokens=1*" %a in ('reg query "HKLM\SYSTEM\CurrentControlSet\Enum\RISDPTSK\Disk&Ven_Ricoh&Prod_SD/MMCStorage&Rev_1.00" ^| findstr /i RISDPTSK') do echo %a>>tst.txt
does tst.txt contain what you expected the value of %a to be? (Modify %a to %%a etc to run this in a test batch/CMD of course.)

Cheers and Regards

User avatar
shiner
Posts: 655
Joined: Sun Nov 08, 2009 4:18 am
Location: SE Asia

Post by shiner » Mon Mar 11, 2013 5:30 am

Well, gora and everyone,

I have benefited immensely from the work and knowledge of other members of this forum and due to gora's prodding I have decided to take the bull by the horns and attempt an updated translation into English of the full help manual for version 1.6 of the module we are using.

gora, if I have questions on any points I will PM you on them.

I don't like making promises I can't keep, and I can't give a timetable for this translation--but I will give it my best google shot. I should have a good amount of free time this month and next.
"You can lead a horse to water, but you can't make it drink."

User avatar
bphlpt
Posts: 1291
Joined: Sat Apr 19, 2008 1:11 am

Post by bphlpt » Mon Mar 11, 2013 10:07 am

Thanks shiner. Let us know how we can help.

Cheers and Regards

Oleg_Sch
Posts: 2
Joined: Sun May 13, 2012 7:46 am

Post by Oleg_Sch » Tue Mar 12, 2013 5:59 am

shiner: Even considering my permanent employment, I promise to help you in this work

User avatar
shiner
Posts: 655
Joined: Sun Nov 08, 2009 4:18 am
Location: SE Asia

Post by shiner » Tue Mar 12, 2013 6:15 am

Oleg,

I have begun by extracting the html from the chm and now I see that it is not that much text to translate.

Jake
"You can lead a horse to water, but you can't make it drink."

User avatar
bphlpt
Posts: 1291
Joined: Sat Apr 19, 2008 1:11 am

Post by bphlpt » Wed Mar 13, 2013 2:07 am

Hey ricktendo, did you ever figure out what was going on with your OT you mentioned above?

Cheers and Regards

User avatar
ricktendo64
Posts: 3212
Joined: Mon May 22, 2006 12:27 am
Location: Honduras

Post by ricktendo64 » Wed Mar 13, 2013 12:03 pm

My code I posted has been working, I just wanted sum1 to take a look at it see if I am making any mistakes

What I need to do is query the registry for the name of this subkey

HKLM\SYSTEM\CurrentControlSet\Enum\RISDPTSK\Disk&Ven_Ricoh&Prod_SD/MMCStorage&Rev_1.00\<HERE>

Then I have to do a reg add with the results and add "Device Parameters" after the subkey (assuming it returned 0001)

reg add "HKLM\SYSTEM\CurrentControlSet\Enum\RISDPTSK\Disk&Ven_Ricoh&Prod_SD/MMCStorage&Rev_1.00\0001\Device Parameters" bla bla bla

This fixes the ions for my memory card readers

User avatar
gora
Posts: 150
Joined: Wed Nov 07, 2007 7:33 am
Location: Ivanovo, Russia

Post by gora » Thu Mar 14, 2013 6:37 am

ricktendo64 wrote:What I need to do is query the registry for the name of this subkey

HKLM\SYSTEM\CurrentControlSet\Enum\RISDPTSK\Disk&Ven_Ricoh&Prod_SD/MMCStorage&Rev_1.00\<HERE>

Code: Select all

[color=#FF00FF]@[/color][color=#0000FF]Echo[/color] Off
[color=#0000FF]SetLocal[/color] EnableDelayedExpansion
[color=#0000FF]Set[/color] sw[color=#FF0000]=[/color]HKEY_CURRENT_USER\Control Panel\Input Method\Hot Keys

[color=#0000FF]For[/color] /F "[color=#0000FF]tokens[/color][color=#FF0000]=*[/color]" [color=#FF8000]%%i[/color] [color=#0000FF]In[/color] [color=#FF0000]([/color]'[color=#0080FF]Reg[/color] QUERY "[color=#FF8000]%sw%[/color]"'[color=#FF0000])[/color] [color=#0000FF]Do[/color] [color=#FF0000]([/color]
	[color=#0000FF]Set[/color] ti[color=#FF0000]=[/color][color=#FF8000]%%i[/color]
	[color=#0000FF]If Not[/color] "!ti:[color=#FF8000]%sw%[/color]\[color=#FF0000]=[/color]!"[color=#FF0000]==[/color]"[color=#FF8000]!ti![/color]" [color=#0000FF]Echo[/color] !ti:[color=#FF8000]%sw%[/color]\[color=#FF0000]=[/color]!
[color=#FF0000])[/color]
[color=#0000FF]Pause[/color]

User avatar
mooms
Posts: 712
Joined: Wed Aug 27, 2008 1:29 pm
Location: France

Post by mooms » Mon May 20, 2013 10:00 am

Any news on the updated English manual ?
Alteration of the world
Want to thank me ? If you buy something on Banggood with this link, I will earn a little %.

User avatar
mooms
Posts: 712
Joined: Wed Aug 27, 2008 1:29 pm
Location: France

Re: 7zsd.sfx / 7zSD_En.CHM: Undocumented Features

Post by mooms » Sun Jul 09, 2017 1:30 pm

Here is the link for build 3900, the latest AFAIK (warning: x64 version are know to not working on newer Windows 10 builds )
7zsd_tools_170_3900.7z

Here is an archive with all versions:
7zsd_tools_All.7z

Chris Lake have updated the x64 version to works with Windows 10:
https://github.com/chrislake/7zsfxmm/releases/
Alteration of the world
Want to thank me ? If you buy something on Banggood with this link, I will earn a little %.

Post Reply