delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2024/07/20/12:52:05

DKIM-Filter: OpenDKIM Filter v2.11.0 delorie.com 46KGq4jC1720097
Authentication-Results: delorie.com;
dkim=pass (1024-bit key, unprotected) header.d=cygwin.com header.i=@cygwin.com header.a=rsa-sha256 header.s=default header.b=G3A5y/be
X-Recipient: archive-cygwin AT delorie DOT com
DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 32524385840D
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cygwin.com;
s=default; t=1721494322;
bh=D9+6/lNTXoaXarZIcp7QRcOCUHyUSvjGNvimCvTKHvU=;
h=To:Cc:Subject:References:Date:In-Reply-To:List-Id:
List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe:
From:Reply-To:From;
b=G3A5y/bevML8+6B0JzrhQzOma95jIPIQhXb7FjejnOXKyIj3jNFXTyIeT9N6syXkl
kMdzArgBB2M7D8X9RXMLc2x6xnJQWa2ZJsd1QUcYLM99H6NWAbZcpUYNJUleSTV/kB
1qH2ZgK8T5EzWMVKGvLFOP/YDjhc048Geh3e36y0=
X-Original-To: cygwin AT cygwin DOT com
Delivered-To: cygwin AT cygwin DOT com
DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 6CE6F3858C41
ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 6CE6F3858C41
ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1721494271; cv=none;
b=k2WHD2zuR2+gUxkI9jqq/yq5hlN37NO71b4ig3Kkh1R0LFIRWwRyZFXzw2E4OMJ4ZQfnXrNi+Yz+ej5uf4jEGzcH/6r5sSIS59iGbn63d5fFBziQKDnaVNjr5lujlTX4VBvPuLgY0Htp1p83xuCAbsYBpUbHSp+2m3dgHf20JTc=
ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key;
t=1721494271; c=relaxed/simple;
bh=GiWrc6BYSBcnmcihtfg0RfAHkpGLCp3ZI/97j+rCbEY=;
h=To:Subject:From:Date:Message-ID:MIME-Version;
b=q3rYTFt3+VqejDIwhCwcSqZMgqvofzSJv8gJe7CWbWXT0QRnw8EfyLapSJB/GvTuaY/ijBzb3DSAymvCkeXnpEx8KB/mYo9ZbTb50PkH3NHLDik6hGPp1QfRaLXGTQ7sYmqSjXH6wXAMWhqSfFNe3D8NWGCbJm0KQJrEWCrbQ1E=
ARC-Authentication-Results: i=1; server2.sourceware.org
To: Mark Liam Brown <brownmarkliam AT gmail DOT com>
Cc: cygwin AT cygwin DOT com
Subject: Re: Parse output of "net use", but language varies - force language
for "net use"?
References: <CAN0SSYzW_im0Fgucbsqk6u=Cu1suSmvhJbskH8doV98mMOTtUg AT mail DOT gmail DOT com>
Date: Sat, 20 Jul 2024 17:51:01 +0100
In-Reply-To: <CAN0SSYzW_im0Fgucbsqk6u=Cu1suSmvhJbskH8doV98mMOTtUg@mail.gmail.com>
(Mark
Liam Brown via Cygwin's message of "Sat\, 20 Jul 2024 15\:44\:17 +0200")
Message-ID: <f5bv810ovm2.fsf@ecclerig.inf.ed.ac.uk>
User-Agent: Gnus/5.101 (Gnus v5.10.10) XEmacs/21.5-b35 (linux)
MIME-Version: 1.0
X-Edinburgh-Scanned: at seine.is.ed.ac.uk
X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00, KAM_DMARC_STATUS,
RCVD_IN_MSPIKE_H4, RCVD_IN_MSPIKE_WL, SPF_HELO_PASS, SPF_PASS,
TXREP autolearn=ham autolearn_force=no version=3.4.6
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on
server2.sourceware.org
X-BeenThere: cygwin AT cygwin DOT com
X-Mailman-Version: 2.1.30
List-Id: General Cygwin discussions and problem reports <cygwin.cygwin.com>
List-Unsubscribe: <https://cygwin.com/mailman/options/cygwin>,
<mailto:cygwin-request AT cygwin DOT com?subject=unsubscribe>
List-Archive: <https://cygwin.com/pipermail/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-request AT cygwin DOT com?subject=help>
List-Subscribe: <https://cygwin.com/mailman/listinfo/cygwin>,
<mailto:cygwin-request AT cygwin DOT com?subject=subscribe>
From: "Henry S. Thompson via Cygwin" <cygwin AT cygwin DOT com>
Reply-To: "Henry S. Thompson" <ht AT inf DOT ed DOT ac DOT uk>
Errors-To: cygwin-bounces~archive-cygwin=delorie DOT com AT cygwin DOT com
Sender: "Cygwin" <cygwin-bounces~archive-cygwin=delorie DOT com AT cygwin DOT com>

Mark Liam Brown via Cygwin writes:

> I am trying to parse the output of "net use" in a bash script, but
> hit a roadblock: The output of "net use" changes with the language
> of the system (English, Danish, French, ...), so parsing becomes
> nearly impossible
>
> How can I force the language used by "net use" to English, even if the
> system default language is Danish or French?

Not sure what your execution environment is, but if you can run it
from under PowerShell, seems possible that a simple PowerShell script
might do the trick, using the right Get-... / Set-... cmdlets as
documented here:

  https://learn.microsoft.com/en-us/powershell/module/international/

Bullet-proofing this so that you don't leave the wrong setting in
place if "net use" etc. blow up is a further requirement for real
deployment.

I don't know enough Windows jargon to figure out _which_ pair will
affect the output from "net use" etc., but someone else may be able to
shed light on that question.

ht
-- 
       Henry S. Thompson, School of Informatics, University of Edinburgh
                10 Crichton Street, Edinburgh EH8 9AB, SCOTLAND
                           e-mail: ht AT inf DOT ed DOT ac DOT uk
                      URL: https://www.ltg.ed.ac.uk/~ht/
 [mail from me _always_ has a .sig like this -- mail without it is forged spam]

-- 
Problem reports:      https://cygwin.com/problems.html
FAQ:                  https://cygwin.com/faq/
Documentation:        https://cygwin.com/docs.html
Unsubscribe info:     https://cygwin.com/ml/#unsubscribe-simple

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019