Multilingual "ECHO Y| CACLS"

A

Andrew Aronoff

I'm writing a cmd-file under W2K that will need to work in _any_
language. The file includes a CACLS command:

echo Y| cacls "filename" /G everyone:F

This works fine, of course, in an English install, but it fails in any
foreign-language install where "Y" is not used locally for "Yes".

Is there any way to write a universally-valid version of this command?
(Unfortunately, I'm restricted from using WMI.)

If not, is there any way to run a prior command that reveals the local
equivalent of "Yes" and "No" so that a locally valid version can be
constructed?

regards, Andy
--
**********

Please send e-mail to: usenet (dot) post (at) aaronoff (dot) com

**********
 
J

Jerold Schulman

I'm writing a cmd-file under W2K that will need to work in _any_
language. The file includes a CACLS command:

echo Y| cacls "filename" /G everyone:F

This works fine, of course, in an English install, but it fails in any
foreign-language install where "Y" is not used locally for "Yes".

Is there any way to write a universally-valid version of this command?
(Unfortunately, I'm restricted from using WMI.)

If not, is there any way to run a prior command that reveals the local
equivalent of "Yes" and "No" so that a locally valid version can be
constructed?

regards, Andy

Use the new XCACLS.VBS, from tip 8225 in the 'Tips & Tricks' at
http://www.jsiinc.com

It doesn't require echoing in batch.


Jerold Schulman
Windows: General MVP
JSI, Inc.
http://www.jsiinc.com
 
M

Matthias Tacke

Andrew Aronoff wrote:
If not, is there any way to run a prior command that reveals the local
equivalent of "Yes" and "No" so that a locally valid version can be
constructed?

regards, Andy
Hi Andy.

I don't know of ready tables specifying the locale yes/no letters.
This batch requires reg.exe to read international settings from the
registry:
::GetRegIntern.cmd:::::::::::::::::::::::::::::::::::::::::::::::::::::
:: REG.EXE required included in XP / RESKIT w2k
@echo off & setlocal EnableExtensions
set "key=HKEY_CURRENT_USER\Control Panel\International"
for /F "tokens=1-3" %%A in ('reg query "%key%"^|findstr "Coun Loc"') do (
echo/set %%A=%%C )
::GetRegIntern.cmd:::::::::::::::::::::::::::::::::::::::::::::::::::::

==screen=copy==========================================================
C:\test>GetRegIntern.cmd
set iCountry=49
set Locale=00000407
set sCountry=Deutschland
==screen=copy==========================================================

If you know the letters of the locales in question you could use
iCountry as an offset into a string/array.

A diifferent way extracts the question string out of the code parsing
the letters. Requires strings.exe
::GetLocalYesNo.cmd:::::::::::::::::::::::::::::::::::::::::::::::::
::Requires http://www.sysinternals.com/ntw2k/source/misc.shtml#strings
@echo off
setlocal
set Exefile=%systemroot%\system32\cacls.exe
for /f "tokens=2,3 delims=(/)" %%A in (
'strings.exe "%ExeFile%"^|findstr "(./.)"'
) do echo.%ExeFile% LocalYes=%%A LocalNo=%%B
::GetLocalYesNo.cmd:::::::::::::::::::::::::::::::::::::::::::::::::

On my german w2k this returns:
==screen=copy==========================================================
C:\Test>GetLocalYesNo.cmd
E:\WINNT\system32\cacls.exe LocalYes=J LocalNo=N
==screen=copy==========================================================
Of course I'm not shure it will wotk with all locales :)

HTH
 
A

Andrew Aronoff

Hi Matthias,

Thanks for your response.
I don't know of ready tables specifying the locale yes/no letters.

I don't really want to be the first to build such a table. ;-)
A diifferent way... Requires strings.exe

Unfortunately, third-party executables and controls are also against
the rules.

I finally found a work-around. Instead of replacing the permissions
with /G, I modify them with /E /G. That doesn't invoke a command-line
prompt and allows me to confer the permissions needed to complete the
task.

regards, Andy

--
**********

Please send e-mail to: usenet (dot) post (at) aaronoff (dot) com

**********
 
M

Matthias Tacke

Andrew said:
Unfortunately, third-party executables and controls are also against
the rules.

I finally found a work-around. Instead of replacing the permissions
with /G, I modify them with /E /G. That doesn't invoke a command-line
prompt and allows me to confer the permissions needed to complete the
task.

regards, Andy
I know my suggestion was a bit like a shot the foot, but I'd assumed
you'd checked the switches at first.
 

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