Parse output of "net use", but language varies - force language for "net use"?

Andrey Repin anrdaemon@yandex.ru
Sun Jul 21 21:05:07 GMT 2024


Greetings, Mark Liam Brown!

> 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?

chcp 65001

Make a symlink to chcp.com from /usr/local/bin/chcp for easier access.
Forcing unicode console CP makes many system programs (netsh, net, route,
ipconfig of what I tried) switch to what appears to be an equivalent of
C.UTF-8 locale, making their output consistent across different OS
localizations.

But frankly, if you really need automation in windows, PowerShell if here
to help. You would be able to do everything in a single, reasonable portable
script, and not need to involve Cygwin at all.


-- 
With best regards,
Andrey Repin
Monday, July 22, 2024 00:01:16

Sorry for my terrible english...



More information about the Cygwin mailing list