Variable in DOS and SET command conflict

Hi,

I have problem with this command in Batch mode

@nodeselect 
@nofilenamequoting 
//@runmode hide
@set lang={dlgchooseS|Choisir la langue source|Allemand=0407+Chinois=1004+Japonais=0411+Russe=0419}
//@externalonly 
@runbatch 
@ECHO off
//echo {$lang} 
SET __COMPAT_LAYER=#ApplicationLocale
SET ApplocaleID={$lang} 
Start /D "C:\Program Files\WinRAR" WinRAR.exe x "{filepath$}" "{file$|noext}\"
@norunbatch 

If @externalonly is off, the command fails because Dopus waits for internal command after SET __COMPAT_LAYER=#ApplicationLocale.

If @externalonly is on, the command partially works because Dopus runs the batch but the batch can't read the Opus variable {$lang} :frowning:

Someone have a solution for this batch run normally and read the variable I set in dlgchooseS :?:

Does this work?

@nodeselect @nofilenamequoting //@runmode hide @externalonly @runbatch @ECHO off SET __COMPAT_LAYER=#ApplicationLocale SET ApplocaleID={dlgchooseS|Choisir la langue source|Allemand=0407+Chinois=1004+Japonais=0411+Russe=0419} Start /D "C:\Program Files\WinRAR" WinRAR.exe x "{filepath$}" "{file$|noext}\" @norunbatch

What's it for, out of interest? Extracting filepaths that aren't stored as Unicode in the archives? (I thought RAR used Unicode paths these days? Maybe it depends how the archive was made?)

Thanks, it works. Why didn't I think of it?

If an archive has files name containing Japanese characters into it, archivers can't extract this files even if eastern language support is installed in windows.

So I have to use MS applocale. But it doesn't support argument in its command line which is

AppLoc.exe "C:\myapp\myapp.exe" "/L[LCID  hexa.]"

So I tried SBAppLocale that's a command line clone of Microsoft AppLocale. Winrar could read eastern name with it but I had error on extracting.

So the best way I found on the net was this batch script trick

@ ECHO OFF SET __COMPAT_LAYER=#ApplicationLocale SET ApplocaleID=[LCID hexa.] Start /D "path" winexe

There is an LocaleStart.vbs that should do the job but it uses Windows Scripting Host that I disabled for security purpose.

[code]option explicit
Set objArgs = WScript.Arguments
If objArgs.Count < 2 Then WScript.Quit

Set Sh = CreateObject("WScript.Shell")
Set Env = Sh.Environment("Process")
Env("__COMPAT_LAYER")="#ApplicationLocale"
Env("AppLocaleID")=objArgs(0)

Cmd = """" + objArgs(1) + """"
For I = 2 to objArgs.Count - 1
Cmd = Cmd + " " + objArgs(I)
Next

Sh.Run Cmd
[/code]

Command line for it is LocaleStart.vbs [LCID hexa.] "path\winexe"

So the button that extract non unicode archive in a new folder with the same name as archive is:

@nodeselect @nofilenamequoting @runmode hide @externalonly @ECHO off SET __COMPAT_LAYER=#ApplicationLocale SET ApplocaleID={dlgchooseS|Choisir la langue source|Allemand=0407+Chinois=1004+Japonais=0411+Russe=0419} Start /D "C:\Program Files\WinRAR" WinRAR.exe x "{filepath$}" "{filepath$|noext}\" del /f /q "%systemroot%\AppPatch\AppLoc.tmp

WinRAR definitely seems able to create RAR archives using Unicode paths, and Opus can then open/extract them without needing any locale stuff setting (and without using WinRAR.exe).

An example is attached (just contains a small text file with a Japanese name).

It probably depends how the archive was made, though.
unicode_names.rar (157 Bytes)