Determine Yes/No/All string for current locale
Posted: 19 Feb 2014 18:54
I would like to determine the Yes / No / and All strings for the current locale in a locale independent manner. This stems from my batchTee.bat script that needs to know the Yes string to be able to cleanly abort a script after Ctrl-C. Thanks jeb for the excellent suggestion.
I decided to generalize the problem to compute all three values.
I believe the following script does the job, but I only have an English machine to test.
Can people with non-English machines please test and report for which language(s) it works or fails? Or if there is a better way, let me know?
Thanks
Dave Benham
I decided to generalize the problem to compute all three values.
I believe the following script does the job, but I only have an English machine to test.
Can people with non-English machines please test and report for which language(s) it works or fails? Or if there is a better way, let me know?
Code: Select all
@echo off
setlocal
set "yes="
copy /y nul test.tmp >nul
for /f "tokens=2-4 delims=(/)" %%A in (
'^<nul copy /-y nul test.tmp'
) do if not defined yes (
set "yes=%%A"
set "no=%%B"
set "all=%%C"
)
del test.tmp
echo yes = %yes%
echo no = %no%
echo all = %all%
::optional code to get the leading character
set "yes=%yes:~0,1%"
set "no=%no:~0,1%"
set "all=%all:~0,1%"
echo yes character = %yes%
echo no character = %no%
echo all character = %all%
Thanks
Dave Benham