Parse output of "net use", but language varies - force language for "net use"?
Mark Liam Brown
brownmarkliam@gmail.com
Sat Jul 20 14:56:56 GMT 2024
On Sat, Jul 20, 2024 at 4:31 PM Bill Stewart via Cygwin
<cygwin@cygwin.com> wrote:
>
> On Sat, Jul 20, 2024 at 7:45 AM Mark Liam Brown via Cygwin wrote:
>
> 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?
> >
>
> This sounds like an XY problem[1] to me....
>
> What is the goal you're trying to accomplish? Enumerate existing
> connections? Get drive mappings?
Basically I need every bit of information out of "net use", "net
config", "net statistics", "net view" and so on, parse it in bash or
perl, process it in bash, and output it in JSON format from the bash
script for our (Linux-based) admin report interface.
Mark
--
IT Infrastructure Consultant
Windows, Linux
More information about the Cygwin
mailing list