Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > alt.comp.os.windows-10 > #195241 > unrolled thread

PSA: How to add WSL grep to the Windwos command-line PATH

Started byMaria Sophia <mariasophia@comprehension.com>
First post2026-08-26 20:08 -0600
Last post2026-08-30 20:19 -0600
Articles 20 on this page of 106 — 17 participants

Back to article view | Back to alt.comp.os.windows-10


Contents

  PSA: How to add WSL grep to the Windwos command-line PATH Maria Sophia <mariasophia@comprehension.com> - 2026-08-26 20:08 -0600
    Re: PSA: How to add WSL grep to the Windwos command-line PATH Maria Sophia <mariasophia@comprehension.com> - 2026-08-27 00:05 -0600
      Re: PSA: How to add WSL grep to the Windwos command-line PATH Lawrence D’Oliveiro <ldo@nz.invalid> - 2026-08-27 07:13 +0000
        Re: PSA: How to add WSL grep to the Windwos command-line PATH "R.Wieser" <address@is.invalid> - 2026-08-27 10:02 +0200
          Re: PSA: How to add WSL grep to the Windwos command-line PATH Maria Sophia <mariasophia@comprehension.com> - 2026-08-27 12:14 -0600
            Re: PSA: How to add WSL grep to the Windwos command-line PATH "R.Wieser" <address@is.invalid> - 2026-08-27 22:06 +0200
              Re: PSA: How to add WSL grep to the Windwos command-line PATH Maria Sophia <mariasophia@comprehension.com> - 2026-08-27 20:39 -0600
                Re: PSA: How to add WSL grep to the Windwos command-line PATH "R.Wieser" <address@is.invalid> - 2026-08-28 14:35 +0200
                  Re: PSA: How to add WSL grep to the Windwos command-line PATH Maria Sophia <mariasophia@comprehension.com> - 2026-08-28 14:47 -0600
            Re: PSA: How to add WSL grep to the Windwos command-line PATH Lawrence D’Oliveiro <ldo@nz.invalid> - 2026-08-27 20:19 +0000
              Re: PSA: How to add WSL grep to the Windwos command-line PATH "Carlos E. R." <robin_listas@es.invalid> - 2026-08-27 22:31 +0200
                Re: PSA: How to add WSL grep to the Windwos command-line PATH Maria Sophia <mariasophia@comprehension.com> - 2026-08-27 20:33 -0600
                  Re: PSA: How to add WSL grep to the Windwos command-line PATH Lawrence D’Oliveiro <ldo@nz.invalid> - 2026-08-28 04:59 +0000
                    Re: PSA: How to add WSL grep to the Windwos command-line PATH Maria Sophia <mariasophia@comprehension.com> - 2026-08-30 21:03 -0600
        Re: PSA: How to add WSL grep to the Windwos command-line PATH Frank Slootweg <this@ddress.is.invalid> - 2026-08-27 10:22 +0000
          Re: PSA: How to add WSL grep to the Windwos command-line PATH Maria Sophia <mariasophia@comprehension.com> - 2026-08-27 11:36 -0600
            Re: PSA: How to add WSL grep to the Windwos command-line PATH Maria Sophia <mariasophia@comprehension.com> - 2026-08-27 12:39 -0600
              Re: PSA: How to add WSL grep to the Windwos command-line PATH "Carlos E. R." <robin_listas@es.invalid> - 2026-08-27 22:20 +0200
              Re: PSA: How to add WSL grep to the Windwos command-line PATH Frank Slootweg <this@ddress.is.invalid> - 2026-08-28 18:07 +0000
                Re: PSA: How to add WSL grep to the Windwos command-line PATH Maria Sophia <mariasophia@comprehension.com> - 2026-08-28 14:49 -0600
            Re: PSA: How to add WSL grep to the Windwos command-line PATH Frank Slootweg <this@ddress.is.invalid> - 2026-08-27 19:11 +0000
              Re: PSA: How to add WSL grep to the Windwos command-line PATH Maria Sophia <mariasophia@comprehension.com> - 2026-08-27 13:21 -0600
                Re: PSA: How to add WSL grep to the Windwos command-line PATH vallor <vallor@vallor.earth> - 2026-08-27 19:59 +0000
                  Re: PSA: How to add WSL grep to the Windwos command-line PATH Maria Sophia <mariasophia@comprehension.com> - 2026-08-27 21:11 -0600
                    Re: PSA: How to add WSL grep to the Windows command-line PATH Lawrence D’Oliveiro <ldo@nz.invalid> - 2026-08-28 05:00 +0000
                      Re: PSA: How to add WSL grep to the Windows command-line PATH Maria Sophia <mariasophia@comprehension.com> - 2026-08-28 15:27 -0600
                        Re: PSA: How to add WSL grep to the Windows command-line PATH Lawrence D’Oliveiro <ldo@nz.invalid> - 2026-08-28 22:26 +0000
                          Re: PSA: How to add WSL grep to the Windows command-line PATH Hank Rogers <Hank@nospam.invalid> - 2026-08-28 17:47 -0500
                            Re: PSA: How to add WSL grep to the Windows command-line PATH Frank Slootweg <this@ddress.is.invalid> - 2026-08-29 14:35 +0000
                Re: PSA: How to add WSL grep to the Windwos command-line PATH Frank Slootweg <this@ddress.is.invalid> - 2026-08-27 20:09 +0000
                  Re: PSA: How to add WSL grep to the Windwos command-line PATH Maria Sophia <mariasophia@comprehension.com> - 2026-08-30 20:32 -0600
                    Re: PSA: How to add WSL grep to the Windwos command-line PATH Maria Sophia <mariasophia@comprehension.com> - 2026-08-30 20:53 -0600
                      Re: PSA: How to add WSL grep to the Windwos command-line PATH Lawrence D’Oliveiro <ldo@nz.invalid> - 2026-08-31 05:34 +0000
                        Re: PSA: How to add WSL grep to the Windwos command-line PATH Frank Slootweg <this@ddress.is.invalid> - 2026-08-31 12:45 +0000
                          Re: PSA: How to add WSL grep to the Windwos command-line PATH Maria Sophia <mariasophia@comprehension.com> - 2026-08-31 09:34 -0600
                            Re: PSA: How to add WSL grep to the Windwos command-line PATH Lawrence D’Oliveiro <ldo@nz.invalid> - 2026-08-31 22:28 +0000
                              Re: PSA: How to add WSL grep to the Windwos command-line PATH Maria Sophia <mariasophia@comprehension.com> - 2026-08-31 21:33 -0600
                                Re: PSA: How to add WSL grep to the Windwos command-line PATH Lawrence D’Oliveiro <ldo@nz.invalid> - 2026-09-01 07:31 +0000
                                Re: PSA: How to add WSL grep to the Windwos command-line PATH Arno Welzel <usenet@arnowelzel.de> - 2026-09-02 17:44 +0200
                            Re: PSA: How to add WSL grep to the Windwos command-line PATH Arno Welzel <usenet@arnowelzel.de> - 2026-09-02 17:41 +0200
                              Re: PSA: How to add WSL grep to the Windwos command-line PATH Paul <nospam@needed.invalid> - 2026-09-02 14:50 -0400
                                Re: PSA: How to add WSL grep to the Windwos command-line PATH Arno Welzel <usenet@arnowelzel.de> - 2026-09-02 22:00 +0200
                                  Re: PSA: How to add WSL grep to the Windwos command-line PATH Richard Kettlewell <invalid@invalid.invalid> - 2026-09-02 21:16 +0100
                                    Re: PSA: How to add WSL grep to the Windwos command-line PATH Maria Sophia <mariasophia@comprehension.com> - 2026-09-02 23:42 +0300
                                      Re: PSA: How to add WSL grep to the Windwos command-line PATH Paul <nospam@needed.invalid> - 2026-09-02 21:36 -0400
                                        Re: PSA: How to add WSL grep to the Windwos command-line PATH Lawrence D’Oliveiro <ldo@nz.invalid> - 2026-09-03 02:28 +0000
                                          Re: PSA: How to add WSL grep to the Windwos command-line PATH Paul <nospam@needed.invalid> - 2026-09-02 23:18 -0400
                                            Re: PSA: How to add WSL grep to the Windwos command-line PATH Lawrence D’Oliveiro <ldo@nz.invalid> - 2026-09-03 05:03 +0000
                                              Re: PSA: How to add WSL grep to the Windwos command-line PATH "Carlos E.R." <robin_listas@es.invalid> - 2026-09-03 08:23 +0200
                                              Re: PSA: How to add WSL grep to the Windwos command-line PATH Maria Sophia <mariasophia@comprehension.com> - 2026-09-04 04:28 +0930
                                    Re: PSA: How to add WSL grep to the Windwos command-line PATH Arno Welzel <usenet@arnowelzel.de> - 2026-09-04 18:37 +0200
                              Re: PSA: How to add WSL grep to the Windwos command-line PATH Dan Purgert <dan@djph.net> - 2026-09-02 19:51 +0000
                                Re: PSA: How to add WSL grep to the Windwos command-line PATH "Carlos E.R." <robin_listas@es.invalid> - 2026-09-02 22:05 +0200
                                  Re: PSA: How to add WSL grep to the Windwos command-line PATH Dan Purgert <dan@djph.net> - 2026-09-02 20:25 +0000
                                    Re: PSA: How to add WSL grep to the Windwos command-line PATH CDB <bellemarecd@gmail.com> - 2026-09-02 22:39 +0200
                    Re: PSA: How to add WSL grep to the Windwos command-line PATH Frank Slootweg <this@ddress.is.invalid> - 2026-08-31 14:24 +0000
                      Re: PSA: How to add WSL grep to the Windwos command-line PATH Maria Sophia <mariasophia@comprehension.com> - 2026-08-31 11:50 -0600
                        Re: PSA: How to add WSL grep to the Windwos command-line PATH vallor <vallor@vallor.earth> - 2026-08-31 18:25 +0000
                          Re: PSA: How to add WSL grep to the Windwos command-line PATH Maria Sophia <mariasophia@comprehension.com> - 2026-09-03 01:18 +0430
        Re: PSA: How to add WSL grep to the Windwos command-line PATH Maria Sophia <mariasophia@comprehension.com> - 2026-08-27 11:53 -0600
          Re: PSA: How to add WSL grep to the Windwos command-line PATH Lawrence D’Oliveiro <ldo@nz.invalid> - 2026-08-27 20:18 +0000
            Re: PSA: How to add WSL grep to the Windwos command-line PATH Maria Sophia <mariasophia@comprehension.com> - 2026-08-27 22:56 -0600
          Re: PSA: How to add WSL grep to the Windwos command-line PATH "Carlos E. R." <robin_listas@es.invalid> - 2026-08-27 22:30 +0200
            Re: PSA: How to add WSL grep to the Windwos command-line PATH Maria Sophia <mariasophia@comprehension.com> - 2026-08-27 23:12 -0600
              Re: PSA: How to add WSL grep to the Windows command-line PATH Lawrence D’Oliveiro <ldo@nz.invalid> - 2026-08-28 06:34 +0000
                Re: PSA: How to add WSL grep to the Windows command-line PATH Maria Sophia <mariasophia@comprehension.com> - 2026-08-28 02:56 -0600
                  Re: PSA: How to add WSL grep to the Windows command-line PATH Maria Sophia <mariasophia@comprehension.com> - 2026-08-29 16:40 -0600
                    Re: PSA: How to add WSL grep to the Windows command-line PATH Lawrence D’Oliveiro <ldo@nz.invalid> - 2026-08-30 02:03 +0000
                      Re: PSA: How to add WSL grep to the Windows command-line PATH Maria Sophia <mariasophia@comprehension.com> - 2026-08-29 23:05 -0600
                        Re: PSA: How to add WSL grep to the Windows command-line PATH Lawrence D’Oliveiro <ldo@nz.invalid> - 2026-08-30 06:56 +0000
                          Re: PSA: How to add WSL grep to the Windows command-line PATH Paul <nospam@needed.invalid> - 2026-08-30 05:26 -0400
                            Re: PSA: How to add WSL grep to the Windows command-line PATH Maria Sophia <mariasophia@comprehension.com> - 2026-08-30 08:23 -0600
                            Re: PSA: How to add WSL grep to the Windows command-line PATH Lawrence D’Oliveiro <ldo@nz.invalid> - 2026-08-30 23:31 +0000
      Re: PSA: How to add WSL grep to the Windwos command-line PATH "J.O. Aho" <user@example.net> - 2026-09-03 08:39 +0200
    Re: PSA: How to add WSL grep to the Windwos command-line PATH Paul <nospam@needed.invalid> - 2026-08-27 04:36 -0400
      Re: PSA: How to add WSL grep to the Windwos command-line PATH Maria Sophia <mariasophia@comprehension.com> - 2026-08-27 10:45 -0600
        Re: PSA: How to add WSL grep to the Windwos command-line PATH Paul <nospam@needed.invalid> - 2026-08-27 14:44 -0400
          Re: PSA: How to add WSL grep to the Windwos command-line PATH Maria Sophia <mariasophia@comprehension.com> - 2026-08-27 12:59 -0600
            Re: PSA: How to add WSL grep to the Windwos command-line PATH Maria Sophia <mariasophia@comprehension.com> - 2026-08-27 13:16 -0600
          Re: PSA: How to add WSL grep to the Windwos command-line PATH Frank Slootweg <this@ddress.is.invalid> - 2026-08-27 19:41 +0000
            Re: PSA: How to add WSL grep to the Windwos command-line PATH vallor <vallor@vallor.earth> - 2026-08-27 20:03 +0000
              Re: PSA: How to add WSL grep to the Windwos command-line PATH Maria Sophia <mariasophia@comprehension.com> - 2026-08-27 19:18 -0600
                Re: PSA: How to add WSL grep to the Windwos command-line PATH Herbert Kleebauer <klee@unibwm.de> - 2026-08-28 12:13 +0200
                  Re: PSA: How to add WSL grep to the Windwos command-line PATH Maria Sophia <mariasophia@comprehension.com> - 2026-08-28 09:51 -0600
                    Re: PSA: How to add WSL grep to the Windwos command-line PATH Herbert Kleebauer <klee@unibwm.de> - 2026-08-28 18:24 +0200
                      Re: PSA: How to add WSL grep to the Windwos command-line PATH Maria Sophia <mariasophia@comprehension.com> - 2026-08-28 11:13 -0600
                        Re: PSA: How to add WSL grep to the Windwos command-line PATH Herbert Kleebauer <klee@unibwm.de> - 2026-08-28 19:36 +0200
                          Re: PSA: How to add WSL grep to the Windwos command-line PATH Frank Slootweg <this@ddress.is.invalid> - 2026-08-28 18:25 +0000
                            Re: PSA: How to add WSL grep to the Windwos command-line PATH Maria Sophia <mariasophia@comprehension.com> - 2026-08-28 13:06 -0600
                        Re: PSA: How to add WSL grep to the Windwos command-line PATH Maria Sophia <mariasophia@comprehension.com> - 2026-08-28 12:18 -0600
            Re: PSA: How to add WSL grep to the Windwos command-line PATH Maria Sophia <mariasophia@comprehension.com> - 2026-08-27 19:37 -0600
              Re: PSA: How to add WSL grep to the Windwos command-line PATH Lawrence D’Oliveiro <ldo@nz.invalid> - 2026-08-28 04:28 +0000
                Re: PSA: How to add WSL grep to the Windwos command-line PATH Maria Sophia <mariasophia@comprehension.com> - 2026-08-28 10:46 -0600
          Re: PSA: How to add WSL grep to the Windows command-line PATH Lawrence D’Oliveiro <ldo@nz.invalid> - 2026-08-28 01:21 +0000
            Re: PSA: How to add WSL grep to the Windows command-line PATH Paul <nospam@needed.invalid> - 2026-08-27 22:21 -0400
              Re: PSA: How to add WSL grep to the Windows command-line PATH Lawrence D’Oliveiro <ldo@nz.invalid> - 2026-08-28 04:25 +0000
                Re: PSA: How to add WSL grep to the Windows command-line PATH Maria Sophia <mariasophia@comprehension.com> - 2026-08-27 23:35 -0600
        Re: PSA: How to add WSL grep to the Windwos command-line PATH Maria Sophia <mariasophia@comprehension.com> - 2026-08-28 10:25 -0600
          Re: PSA: How to add WSL grep to the Windwos command-line PATH Paul <nospam@needed.invalid> - 2026-08-28 15:37 -0400
            Re: PSA: How to add WSL grep to the Windwos command-line PATH "Carlos E. R." <robin_listas@es.invalid> - 2026-08-29 13:16 +0200
              Re: PSA: How to add WSL grep to the Windwos command-line PATH Maria Sophia <mariasophia@comprehension.com> - 2026-08-29 16:27 -0600
    Re: PSA: How to add WSL grep to the Windwos command-line PATH Arno Welzel <usenet@arnowelzel.de> - 2026-08-30 12:58 +0200
      Re: PSA: How to add WSL grep to the Windwos command-line PATH "Kerr-Mudd, John" <admin@127.0.0.1> - 2026-08-30 12:48 +0100
        Re: PSA: How to add WSL grep to the Windwos command-line PATH Maria Sophia <mariasophia@comprehension.com> - 2026-08-30 08:23 -0600
    Re: PSA: How to add WSL grep to the Windwos command-line PATH Brian Gregory <void-invalid-dead-dontuse@email.invalid> - 2026-08-31 01:15 +0100
      Re: PSA: How to add WSL grep to the Windwos command-line PATH Maria Sophia <mariasophia@comprehension.com> - 2026-08-30 20:19 -0600

Page 5 of 6 — ← Prev page 1 2 3 4 [5] 6  Next page →


#195264

Fromvallor <vallor@vallor.earth>
Date2026-08-27 20:03 +0000
Message-ID<116q573$1ok95$2@dont-email.me>
In reply to#195262
At 27 Aug 2026 19:41:57 GMT, Frank Slootweg <this@ddress.is.invalid>
wrote:

> Paul <nospam@needed.invalid> wrote:
> > On Thu, 8/27/2026 12:45 PM, Maria Sophia wrote:
> [...]
> > > I just realized that Microsoft's Coreutils package doesn't give
> > > us grep, sed, cut or awk, so we still need additional Linux-like
> > > packages.
> > >
> > > Drat. Nonetheless, I just installed the coreutils, but I haven't
> > > tested it yet.
> >
> > The package definitions, you can see them in gnuwin32. This provides
> > a "framework" for "existence".
> >
> >    https://gnuwin32.sourceforge.net/packages.html
> >
> > Coreutils only covers a range of common utilities.
> > GREP and Sed are separate packages in that tree.
>
>   I don't know what the fuss is about. The 'Coreutils for Windows'
>   page
> clearly says that it includes grep (and cut, but indeed not sed or
> awk).
>
> <https://learn.microsoft.com/en-us/windows/core-utils/overview>
>
> <https://learn.microsoft.com/en-us/windows/core-utils/commands>
>
>   grep is a different part of *uutils* (uutils/grep, not
> uutils/coreutils), but *included* in 'Coreutils for Windows'.
>
>   Anyway, as mentioned, I prefer Cygwin, which is (modular and) more
> complete than both 'Coreutils for Windows' and GnuWin.
>
> [...]

I'll note here that using the Cygwin grep(1) is a 0-line solution,
which is superior to running grep in an emulator.

"Maria" seems to have spent several articles patting himself on
the back.  He could have used the time to install adb in WSL
and just do everything from Linux, natively.

HTH.  HAND.

-- 
-v System76 Thelio Mega v1.1 x86_64 Mem: 258G
   OS: Linux 7.2.1 D: Mint 22.3 DE: Xfce 4.18 (X11)
   NVIDIA GeForce RTX 3090Ti (24G) (610.57.04)
   "Death is natures way of telling you to slow down."

[toc] | [prev] | [next] | [standalone]


#195276

FromMaria Sophia <mariasophia@comprehension.com>
Date2026-08-27 19:18 -0600
Message-ID<116qnkg$22k$1@nnrp.usenet.blueworldhosting.com>
In reply to#195264
vallor wrote:
> I'll note here that using the Cygwin grep(1) is a 0-line solution,
> which is superior to running grep in an emulator.
> 
> ... could have used the time to install adb in WSL
> and just do everything from Linux, natively.

Hi "vallor",

Thank you for the alternative proposals, even if they missed the target.

Both your suggestions were attempts to solve the problem, which is 
appreciated because Usenet is very unkind to people who try to help.

To answer your first point, there's nothing wrong with the classic 
cygwin1.dll POSIX emulation layer (which most of us used as ported GNU 
coreutils three decades ago, which is well before WSL even existed). 

But that emulation-layer abomination isn't the topic of this thread.

The topic, as stated in the subject, is bridging WSL to the Windows CLI. 
Specifically:
 a. The user already has WSL installed.
 b. The goal is simply to run native Linux WSL calls from the Windows CLI 
    (using grep as the primary example).

The thread is NOT about the best way to turn Windows into Linux, nor is it 
about debating the well-known POSIX-to-Win32 translation abominations.

The goal is to run this command using the WSL layer in CLI:
 C:> adb shell pm list packages | grep -i gsf
in the simplest way possible, given the WSL layer already exists.

All this thread does is suggest a brilliant way to bridge that gap.
Using a single line file, called "grep.cmd" containing @wsl grep %*

I came up with that solution on my own, but if others know of an even 
easier, even simpler solution than that one-line file, let us all know!

As for your second helpful suggestion of shifting the entire workflow into 
a Linux VM, that's pretty much what Lawrence had kindly suggested.

While there's nothing wrong with a native Linux flow, that's NOT what this 
thread is about, where, I repeat, what this thread is about is it's a 
public service announcement about an elegant 1-line solution that bridges 
the gap instantly between the existing WSL and the Windows command line.

To be fair to you, you may not be aware that I run adb over Wi-Fi because 
my USB port is broken. The Windows host is already connected to the phone's 
TCP/IP daemon. Suggesting we "just install adb in WSL" means managing a 
completely separate Android SDK installation, daemon lifecycle, and 
port-forwarding bridge inside Linux-all just to run:

C:> adb shell pm list packages | grep -i gsf

By contrast, the one-line wrapper script (grep.cmd containing @wsl grep %*) 
keeps the adb tool where the network connection lives (cmd) while borrowing 
the parser we actually want. 

It's actually a brilliantly simple lightweight, pragmatic fix, IMHO.

In summary, thank you for the idea of using the cygwin layer that I gave up 
on, oh, maybe not thirty years ago, but somewhere between twenty years ago 
and about a decade ago, where I never want to use that abomination again.

However, both your kindly suggested ideas were worth looking at, so I 
appreciate that you tried to help, where the conversation helps all of us.
-- 
On Usenet, we find people who come with vast backgrounds in systems design	
.

[toc] | [prev] | [next] | [standalone]


#195295

FromHerbert Kleebauer <klee@unibwm.de>
Date2026-08-28 12:13 +0200
Message-ID<116rn14$27gtu$1@dont-email.me>
In reply to#195276
On 8/28/2026 3:18 AM, Maria Sophia wrote:

> All this thread does is suggest a brilliant way to bridge that gap.
> Using a single line file, called "grep.cmd" containing @wsl grep %*
> 
> I came up with that solution on my own, but if others know of an even
> easier, even simpler solution than that one-line file, let us all know!

I don't use WSL nor doskey, but doesn't a simple

doskey grep=wsl grep

what you want? No need for a batch file and maybe problems
with poisoned characters (%^...) in %*. And you can automatically
load the doskey commands at startup of CMD.EXE.


[toc] | [prev] | [next] | [standalone]


#195304

FromMaria Sophia <mariasophia@comprehension.com>
Date2026-08-28 09:51 -0600
Message-ID<116saqd$1qm6$1@nnrp.usenet.blueworldhosting.com>
In reply to#195295
Herbert Kleebauer wrote:
>> All this thread does is suggest a brilliant way to bridge that gap.
>> Using a single line file, called "grep.cmd" containing @wsl grep %*
>> 
>> I came up with that solution on my own, but if others know of an even
>> easier, even simpler solution than that one-line file, let us all know!
> 
> I don't use WSL nor doskey, but doesn't a simple
> 
> doskey grep=wsl grep
> 
> what you want? No need for a batch file and maybe problems
> with poisoned characters (%^...) in %*. And you can automatically
> load the doskey commands at startup of CMD.EXE.

Hi Herbert,

Thanks for that doskey suggestion of doskey grep=wsl grep

Over the years I've used almost every one of your suggestions, where only
recently I retired the clever method you showed me of opening sans console
 showwin.exe 5
 del showwin.exe
 goto :eof

I don't even remember if I ever knew about doskey, so I had to look it up.
 doskey grep=wsl grep $*
Where $* is doskey's macro syntax for all arguments supplied to the macro.

Looking it up, doskey is elegant but it's quite different in how it works.

For example, we have to arrange for the macro to be installed in each CMD
session, which isn't difficult to do, but the @wsl method is in the path.

However, your point about poisoning is indeed valid, as .cmd file is
subject to cmd.exe's parsing and expansion rules. So the wrapper isn't a
transparent Unix-to-Windows argument-passing mechanism either. 

There will be edge cases involving quoting, metacharacters, %, ^, etc., as
we've found out in spades for the previous awk.cmd examples tested earlier.

For grep, Paul's suggestion of using the brand new Microsoft Rust CoreUtils
(which were just released this summer) seems to be the simplest solution. 
  C:\> winget install Microsoft.Coreutils
 
Unfortunately, that doesn't work for awk either, as, for whatever reason, 
Microsoft didn't add the awk or sed commands, so I'm using WSL for sed.

So far, grep, sed & tr worked well in my tests, but awk failed miserably.

Thank you for your helpful suggestion of using doskey, as that was an idea
I had not even thought of, where it's nice everyone volunteered advice.
-- 
Usenet is where people with vast knowledge converge to discuss ideas.

[toc] | [prev] | [next] | [standalone]


#195306

FromHerbert Kleebauer <klee@unibwm.de>
Date2026-08-28 18:24 +0200
Message-ID<116sco5$2h6ln$1@dont-email.me>
In reply to#195304
On 8/28/2026 5:51 PM, Maria Sophia wrote:
> Herbert Kleebauer wrote:

> For example, we have to arrange for the macro to be installed in each CMD
> session, which isn't difficult to do, but the @wsl method is in the path.
If you want to use grep within a batch, you can also write the
doskey command at the top of the batch file and in the batch
itself you use the normal grep command. This way only wsl has
to be installed, no need to also copy batch files to a new PC.

But your grep.cmd solution would only work within a batch if
you write:

call grep

but then it would be easier (I think, you like to type a character less)
to just write:

wsl grep



[toc] | [prev] | [next] | [standalone]


#195312

FromMaria Sophia <mariasophia@comprehension.com>
Date2026-08-28 11:13 -0600
Message-ID<116sfk8$vma$1@nnrp.usenet.blueworldhosting.com>
In reply to#195306
Herbert Kleebauer wrote:
> If you want to use grep within a batch, you can also write the
> doskey command at the top of the batch file and in the batch
> itself you use the normal grep command. This way only wsl has
> to be installed, no need to also copy batch files to a new PC.
> 
> But your grep.cmd solution would only work within a batch if
> you write:
> 
> call grep
> 
> but then it would be easier (I think, you like to type a character less)
> to just write:
> 
> wsl grep

Hi Herbert,

The goal of this PSA is to bridge Windows with Linux so that common
adb examples found on the Internet can be pasted, verbatim, into the CLI.

To that end, I very much appreciate Paul's suggestion of CoreUtils, 
and your suggestion of DosKey to improve the connection of Linux:Windows.

I have to look up & test doskey s'more, as I don't even remember if I ever 
knew about it, even as I started with the AT in the early days where I had 
Peter Norton edit my debug tutorial which I had posted to Usenet somewhere.

While I greatly appreciate that you're following up on my statement to 
vallor that the @WSL solution seemed elegant to me (in its own way), I 
agree that the doskey solution is likewise elegant, in its own way too.

We're all working together to improve the native inclusion of linux 
commands, particularly for the case of running commonly found adb examples.
 C:\> adb shell dumpsys battery | grep level
        level: 95 
 C:\> adb shell pm list packages | sed "s/package://g" | grep filemanager
        za.kilowatch.ultimatefilemanager   
        ... 
  C:\> adb shell pm list packages | tr "." "-" | grep filemanager
        package:za-kilowatch-ultimatefilemanager   

Where most seem to be working well now, save for that darn awk.
 C:\> adb shell "dumpsys battery | awk '/level:/ {print \"Battery Level:\", $2 \"%\"}'"
        Battery Level: 94%

Most of what I'm learning is by empirical testing, where I'm not 'xactly
sure if the  doskey macro works inside a batch file as described though.

Apparently doskey macros are expanded for interactive command-line 
input, but a batch file apparently doesn't invoke them when it encounters:
  ... grep ... 
So putting:
  doskey grep=wsl grep $*
at the top of the batch file might not actually make the subsequent grep 
commands use that macro. I'm not sure about that, so it needs testing
as, for a batch file at least, wsl grep might still be necessary.

Your astute point about my grep.cmd wrapper is correct, though. 

If a batch file invokes another batch file, it needs call if execution 
is to return to the original batch file:
 call grep -i gsf
So in a batch file, wsl grep -i gsf is indeed simpler.

But, I'm going to delete the grep.cmd since Paul's suggestion of the 
Microsoft Rust CoreUtils has replaced WSL with a native implementation.

For the original interactive use case, however, the doskey solution is 
quite elegant, since it avoids creating a wrapper file. The tradeoff is 
that the macro has to be established for each CMD session.

For grep, the Microsoft CoreUtils solves that problem quite nicely.
  winget install Microsoft.Coreutils
So neither WSL nor a grep.cmd wrapper nor a doskey macro is needed
for grep.

For now, I'm keeping WSL for sed but, unfortunately, awk is a PITA.

Thanks for pushing the doskey idea further as these discussions 
help kick the can forward so that everyone can use Linux adb examples
simply by copying them and pasting without needing to translate.
-- 
Helpful suggestions from people are why Usenet still remains invaluable.

[toc] | [prev] | [next] | [standalone]


#195313

FromHerbert Kleebauer <klee@unibwm.de>
Date2026-08-28 19:36 +0200
Message-ID<116sgv0$2ip9d$1@dont-email.me>
In reply to#195312
On 8/28/2026 7:13 PM, Maria Sophia wrote:

> The goal of this PSA is to bridge Windows with Linux so that common
> adb examples found on the Internet can be pasted, verbatim, into the CLI.

I think, the correct solution is, to install Linux in a virtual
machine. On your next PC install Linux as main OS and Windows in
a virtual machine. And then, in any further PC, you only need Linux.

[toc] | [prev] | [next] | [standalone]


#195319

FromFrank Slootweg <this@ddress.is.invalid>
Date2026-08-28 18:25 +0000
Message-ID<116sqr3.9n8.1@ID-201911.user.individual.net>
In reply to#195313
Herbert Kleebauer <klee@unibwm.de> wrote:
> On 8/28/2026 7:13 PM, Maria Sophia wrote:
> 
> > The goal of this PSA is to bridge Windows with Linux so that common
> > adb examples found on the Internet can be pasted, verbatim, into the CLI.
> 
> I think, the correct solution is, to install Linux in a virtual
> machine. On your next PC install Linux as main OS and Windows in
> a virtual machine. And then, in any further PC, you only need Linux.

  He mentioned WSL and Ubuntu, so (AFAICT) he already has "Linux in a
virtual machine".

  Whether or not he wants/needs the subsequent steps you describe, is
another matter. AFAICT/AFAIK, he needs/uses Windows more than Linux.

[toc] | [prev] | [next] | [standalone]


#195320

FromMaria Sophia <mariasophia@comprehension.com>
Date2026-08-28 13:06 -0600
Message-ID<116sm7i$1gbb$1@nnrp.usenet.blueworldhosting.com>
In reply to#195319
Frank Slootweg wrote:
>>> The goal of this PSA is to bridge Windows with Linux so that common
>>> adb examples found on the Internet can be pasted, verbatim, into the CLI.
>> 
>> I think, the correct solution is, to install Linux in a virtual
>> machine. On your next PC install Linux as main OS and Windows in
>> a virtual machine. And then, in any further PC, you only need Linux.
> 
>   He mentioned WSL and Ubuntu, so (AFAICT) he already has "Linux in a
> virtual machine".
> 
>   Whether or not he wants/needs the subsequent steps you describe, is
> another matter. AFAICT/AFAIK, he needs/uses Windows more than Linux.

These are all good suggestions, as the solution to the problem is what
matters, although I admit, I've been burned many times by a Linux VM.

I don't know if I have too little experience with the Linux VM.
Or too much.

The problem I've experienced in the past is getting OUT of the VM.
It has to talk to the hardware.

However, it has been a long time since I gave up on VMs talking to devices.
Have they improved on that huge interoperability problem yet?

[toc] | [prev] | [next] | [standalone]


#195318

FromMaria Sophia <mariasophia@comprehension.com>
Date2026-08-28 12:18 -0600
Message-ID<116sjdj$1ojb$1@nnrp.usenet.blueworldhosting.com>
In reply to#195312
Maria Sophia wrote:
> Where most seem to be working well now, save for that darn awk.
>  C:\> adb shell "dumpsys battery | awk '/level:/ {print \"Battery Level:\", $2 \"%\"}'"
>         Battery Level: 94%

UPDATE

Running this inside quotes directly on the adb shell worked fine because 
it was executed entirely inside Android's Linux environment:
 C:\> adb shell "dumpsys battery | awk '/level:/ {print \"Battery Level:\", $2 \"%\"}'"
      Battery Level: 94%

But it had failed when running inside the Windows command line.
 C:\> adb shell dumpsys battery | awk '/level:/ {print \"Battery Level:\", $2 \"%\"}'
       awk: cmd. line:1: /level:/ {print \"Battery Level:\", $2 \"%\"}
       awk: cmd. line:1:                 ^ backslash not last character on line

This is apparently due to quirks in how Windows cmd.exe handles syntax 
compared to how Linux bash handles that same syntax.

 1. Single quotes work fine in Linux, but not in Windows
    (so we have to use double quotes instead)
 2. Unescaped dollar signs work fine in Linux, but not in Windows
    (so we have to escape the dollar signs instead)
 3. Linux adb outputs LF (\n) while Windows adb outputs CRLF (\r\n)
    (so we have to pipe it to a translate to clean up line endings)

With those three changes, the wsl awk example now works:
 C:\> adb shell dumpsys battery | wsl tr -d '\r' | wsl awk "/level:/ {print \"Battery Level:\", \$2 \"%\"}"

Which, using MS CoreUtils tr & awk.cmd from this PSA, becomes...
 C:\> type awk.cmd
       @wsl awk %*
 C:\> adb shell dumpsys battery | tr -d '\r' | awk "/level:/ {print \"Battery Level:\", \$2 \"%\"}"
      Battery Level: 92%

As Lawrence and Carlos noted early on, running adb linux commands in 
Windows mixes three distinct environments which turns a simple text
pipeline into a miniature diplomatic translation layer because each 
system speaks a completely different dialect of shell rules, 
quoting conventions, and line endings.

Luckily, the most common adb examples are simpler, so they work better.
 C:\> adb shell dumpsys battery | grep level
        level: 95 
 C:\> adb shell pm list packages | sed "s/package://g" | grep filemanager
        za.kilowatch.ultimatefilemanager   
        ... 
  C:\> adb shell pm list packages | tr "." "-" | grep filemanager
        package:za-kilowatch-ultimatefilemanager 
-- 
Android, Windows & Linux walk into a bar to discuss their differences.

[toc] | [prev] | [next] | [standalone]


#195278

FromMaria Sophia <mariasophia@comprehension.com>
Date2026-08-27 19:37 -0600
Message-ID<116qooj$1l7$1@nnrp.usenet.blueworldhosting.com>
In reply to#195262
Frank Slootweg wrote:
>> Coreutils only covers a range of common utilities.
>> GREP and Sed are separate packages in that tree.
> 
>   I don't know what the fuss is about. The 'Coreutils for Windows' page
> clearly says that it includes grep (and cut, but indeed not sed or awk).
> 
> <https://learn.microsoft.com/en-us/windows/core-utils/overview>
> <https://learn.microsoft.com/en-us/windows/core-utils/commands>
> 
>   grep is a different part of *uutils* (uutils/grep, not
> uutils/coreutils), but *included* in 'Coreutils for Windows'.
> 
>   Anyway, as mentioned, I prefer Cygwin, which is (modular and) more
> complete than both 'Coreutils for Windows' and GnuWin.

Thank you Frank for suggesting we look up if grep resides in coreutils.
Ah. I just tested grep for the first time to see if it's in coreutils.

Woo hoo!
As Frank noted, grep is there!

  C:\> where grep
        C:\Program Files\coreutils\bin\grep.exe
        C:\Users\username\adb\grep.cmd

Hence, an apology is due to both Frank & Paul since I had installed
coreUtils for Windows while I was reading Paul's kind and helpful
suggestion, but I clearly said I had not *tested* them at the time.
  C:\> winget install Microsoft.Coreutils
  C:\> setx PATH "%PATH%;C:\Program Files\coreutils"

The documentation I read (and cited) seemed to say grep wasn't part of the
core utils, to which Frank has just responded to, as I was wrong on that.

Interestingly, all the grep commands I used today from inside the Windows
command line are actually, based on that, coming from the core utils!

Even more interesting is Frank's helpful suggestion about sed & awk!
  C:\> where sed
       C:\Users\username\adb\sed.cmd
  C:\> where awk
       C:\Users\username\adb\awk.cmd
  C:\> where tr
       C:\Program Files\coreutils\bin\tr.exe
       C:\Users\username\adb\tr.cmd

So let's test the coreutils that I mentioned to Paul were not tested!

In summary, I think Paul's idea of coreutils (with the caveats Frank
mentioned about grep, awk & sed taken into account) is useful to test!

Thank you both Frank and Paul for bringing up that coreutils has grep!
-- 
Usenet is a community of kind hearted people who help each other learn.

[toc] | [prev] | [next] | [standalone]


#195287

FromLawrence D’Oliveiro <ldo@nz.invalid>
Date2026-08-28 04:28 +0000
Message-ID<116r2pj$218ss$2@dont-email.me>
In reply to#195278
On Thu, 27 Aug 2026 19:37:23 -0600, Maria Sophia wrote:

> Thank you Frank for suggesting we look up if grep resides in
> coreutils. Ah. I just tested grep for the first time to see if it's
> in coreutils.
>
> Woo hoo!
> As Frank noted, grep is there!
>
>   C:\> where grep
>         C:\Program Files\coreutils\bin\grep.exe
>         C:\Users\username\adb\grep.cmd

Not in Linux, it’s not:

    ldo@hypatia:~> dpkg-query -S $(type -p grep)
    grep: /usr/bin/grep

    ldo@hypatia:~> dpkg-query -S $(type -p cp)
    coreutils: /usr/bin/cp

[toc] | [prev] | [next] | [standalone]


#195309

FromMaria Sophia <mariasophia@comprehension.com>
Date2026-08-28 10:46 -0600
Message-ID<116se0t$1t34$1@nnrp.usenet.blueworldhosting.com>
In reply to#195287
Lawrence D¢Oliveiro wrote:
>> As Frank noted, grep is there!
>>
>>   C:\> where grep
>>         C:\Program Files\coreutils\bin\grep.exe
>>         C:\Users\username\adb\grep.cmd
> 
> Not in Linux, it¢s not:
> 
>     ldo@hypatia:~> dpkg-query -S $(type -p grep)
>     grep: /usr/bin/grep
> 
>     ldo@hypatia:~> dpkg-query -S $(type -p cp)
>     coreutils: /usr/bin/cp

Hi Lawrence,

Ah, I think I see your point. Thanks for brining it up so clearly.

In your Debian system:
 /usr/bin/cp is supplied by the Debian coreutils package
 /usr/bin/grep is supplied by a separate Debian grep package
That's a useful distinction which Windows owners should take note of.

I think your astute point may have been to let us know that I was 
accidentally conflating Microsoft's package name, Coreutils, with the 
traditional GNU/Linux coreutils package. 

You showed that in GNU/Linux, grep isn't part of GNU Coreutils.
It's a separate GNU project/package:
 coreutils -> cp, mv, rm, cat, ...
 grep      -> grep

So I think what you're intimating is that this newly released set of 
Windows Coreutils shouldn't be thought of as simply the Linux coreutils 
package for Windows as it is a collection of utilities which are different.

Specifically, the Microsoft CoreUtils grep comes from the Rust uutils/grep 
project rather than from the GNU grep project, is that right?

It seems the Microsoft repository says that its grep is based on a fork of 
uutils/grep, while most of the other utilities come from uutils/coreutils:
 <https://github.com/microsoft/coreutils/blob/main/CONTRIBUTING.md>

That's all new to me as I only learned about Microsoft's Coreutils package 
from Paul this week. The first release appears to have been June 2, 2026:
 <https://github.com/microsoft/coreutils/discussions/4>

Had I known about this package, that Paul was hiding from us (jk), I would 
have written a PSA about using it, instead of bridging WSL to the CLI.

Speaking of the public service announcement, since I didn't know about the 
Microsoft CoreUtils until Paul mentioned them, the only reason to even 
consider this PSA going forward are for the commands NOT in CoreUtils.

That's because Microsoft's utilities are native Windows executables, 
whereas my original grep.cmd was merely a wrapper that bridged from Windows 
into WSL to run the Linux binary (but the sed.cmd" is still useful).
 <https://learn.microsoft.com/en-us/windows/core-utils/overview>

So I'm going to revise the recommendation in the PSA. 

 1. For grep at least, the much cleaner solution now seems to be 
    simply installing Microsoft's Coreutils rather than maintaining
    a grep.cmd wrapper around WSL.
    <https://github.com/microsoft/coreutils/releases/download/v2026.6.16/coreutils-2026.6.16-x64.exe>
 2. For sed, it seems (so far) the sed.cmd @WSL method is working
 3. But, we still need a better solution for awk.

Luckily, the main need, at least for the stated problem set of
running adb examples found on the net, is mostly for just grep.

Thanks for pointing out the distinctions!
-- 
On Usenet, we teach what we know & then others teach us what we didn't know.

[toc] | [prev] | [next] | [standalone]


#195277 — Re: PSA: How to add WSL grep to the Windows command-line PATH

FromLawrence D’Oliveiro <ldo@nz.invalid>
Date2026-08-28 01:21 +0000
SubjectRe: PSA: How to add WSL grep to the Windows command-line PATH
Message-ID<116qnqh$1ui3d$4@dont-email.me>
In reply to#195257
On Thu, 27 Aug 2026 14:44:23 -0400, Paul wrote:

> Winget may span more than one repository. As if I do this:
>
>    winget list
>
> I don't see any Coreutils by doing that.

I understand what Microsoft have actually done is port the Rust-based
remake of Coreutils, rather than the original versions written in C.

I further understand that there are some inadvertent incompatibilities
in the Rust-based Coreutils, which has caused Ubuntu to revert
embracing them and go back to the original versions.

<https://linuxiac.com/ubuntu-reverts-rust-cp-after-it-breaks-live-image-builds/>

[toc] | [prev] | [next] | [standalone]


#195280 — Re: PSA: How to add WSL grep to the Windows command-line PATH

FromPaul <nospam@needed.invalid>
Date2026-08-27 22:21 -0400
SubjectRe: PSA: How to add WSL grep to the Windows command-line PATH
Message-ID<116qraq$1vhs5$1@dont-email.me>
In reply to#195277
On Thu, 8/27/2026 9:21 PM, Lawrence D’Oliveiro wrote:
> On Thu, 27 Aug 2026 14:44:23 -0400, Paul wrote:
> 
>> Winget may span more than one repository. As if I do this:
>>
>>    winget list
>>
>> I don't see any Coreutils by doing that.
> 
> I understand what Microsoft have actually done is port the Rust-based
> remake of Coreutils, rather than the original versions written in C.
> 
> I further understand that there are some inadvertent incompatibilities
> in the Rust-based Coreutils, which has caused Ubuntu to revert
> embracing them and go back to the original versions.
> 
> <https://linuxiac.com/ubuntu-reverts-rust-cp-after-it-breaks-live-image-builds/>
> 

A topic like this, is a bit like explaining wine selection,
to people who don't drink wine. You have to do your research
and select a good vintage.

At least with cygwin, you used to see some amount of curation,
some amount of organization. The x86 version, I liked that and
had installed it several times over the years. But when that
was discontinued and an x64 version showed up, I installed
that one day, and there was some disconcerting network activity,
(something you never saw on the x86 version), I uninstalled it
and that was the last Cygwin here. But other than that, at least
you have a lineup of stuff that's all been tested and packages
managed.

The winget thing, I have no idea if it has any concept of
"Repository" or it just "shops at the 7-11 and the Dollar Store".
It seems to be downloading from Sourceforge. Working with Sourceforge
is fine, as long as you do some amount of investigation before
the install step. A thing like WinGet as a concept, to be shooting
from the hip like that, the Repository used must be well maintained
to be that trusting. And finding it downloading from Sourceforge
does not inspire confidence. I have no idea what the folks at
Sourceforge do, to ensure no supply side attacks. I could understand this
behavior, if say, Microsoft had bought Sourceforge.

   Paul

[toc] | [prev] | [next] | [standalone]


#195286 — Re: PSA: How to add WSL grep to the Windows command-line PATH

FromLawrence D’Oliveiro <ldo@nz.invalid>
Date2026-08-28 04:25 +0000
SubjectRe: PSA: How to add WSL grep to the Windows command-line PATH
Message-ID<116r2kj$218ss$1@dont-email.me>
In reply to#195280
On Thu, 27 Aug 2026 22:21:14 -0400, Paul wrote:

> On Thu, 8/27/2026 9:21 PM, Lawrence D’Oliveiro wrote:
>>
>> I understand what Microsoft have actually done is port the
>> Rust-based remake of Coreutils, rather than the original versions
>> written in C.
>>
>> I further understand that there are some inadvertent
>> incompatibilities in the Rust-based Coreutils, which has caused
>> Ubuntu to revert embracing them and go back to the original
>> versions.
>>
>> <https://linuxiac.com/ubuntu-reverts-rust-cp-after-it-breaks-live-image-builds/>
>>
> A topic like this, is a bit like explaining wine selection, to
> people who don't drink wine. You have to do your research and select
> a good vintage.

The cp(1) command is documented to work a certain way. The C version
does that, the Rust version doesn’t.

<https://manpages.debian.org/cp(1)>

[toc] | [prev] | [next] | [standalone]


#195292 — Re: PSA: How to add WSL grep to the Windows command-line PATH

FromMaria Sophia <mariasophia@comprehension.com>
Date2026-08-27 23:35 -0600
SubjectRe: PSA: How to add WSL grep to the Windows command-line PATH
Message-ID<116r6mj$h42$1@nnrp.usenet.blueworldhosting.com>
In reply to#195286
Lawrence D¢Oliveiro wrote:
>>> I understand what Microsoft have actually done is port the
>>> Rust-based remake of Coreutils, rather than the original versions
>>> written in C.
>>>
>>> I further understand that there are some inadvertent
>>> incompatibilities in the Rust-based Coreutils, which has caused
>>> Ubuntu to revert embracing them and go back to the original
>>> versions.
>>>
>>> <https://linuxiac.com/ubuntu-reverts-rust-cp-after-it-breaks-live-image-builds/>
>>>
>> A topic like this, is a bit like explaining wine selection, to
>> people who don't drink wine. You have to do your research and select
>> a good vintage.
> 
> The cp(1) command is documented to work a certain way. The C version
> does that, the Rust version doesn¢t.
> 
> <https://manpages.debian.org/cp(1)>

I only heard of the "rust coreutils" yesterday, but from what I gather, it 
seems that Rust Coreutils isn't "Linux technology brought to Windows" so 
much as a cross-platform reimplementation of the Unix/GNU utilities, 
written once in Rust and compiled for different operating systems.	.

Hence I would agree with anyone who logically sensibly assserts that the 
Rust CoreUtils should work the way commands are documented to work.

Regarding someone's comment about winget and core utils, this is useful:
 C:\> winget list | grep -i coreutils
      Coreutils for Windows version 2026.6.16 Microsoft.Coreutils 2026.6.16 winget

It appears to be brand new stuff as of June 16, 2026 (apparently).

I like the idea of using CoreUtils in Windows because it has
apparently a robust version of grep, but it doesn't have awk (AFAIK).

[toc] | [prev] | [next] | [standalone]


#195307

FromMaria Sophia <mariasophia@comprehension.com>
Date2026-08-28 10:25 -0600
Message-ID<116scp4$1rjh$1@nnrp.usenet.blueworldhosting.com>
In reply to#195251
Maria Sophia wrote:
> Then we need to add coreutils to the Windows path
>  C:\> setx PATH "%PATH%;C:\Program Files\coreutils"
>       SUCCESS: Specified value was saved.

WARNING!

Drat. That was a mistake!
  C:\> echo %PATH%
       Reports coreutils, then stuff, the same stuff, and coreutils again

That setx method was the wrong method, but worse, it wasn't even needed!

Since the purpose of this thread is to be a public service announcement to 
help others run Linux commands like "grep" on the CLI, notethat the setx 
above duplicated the path, and worse, the winget of coreutils added the 
coreutils to the BEGINNING of the path, so, the end result was:
  a. CoreUtils was in the beginning of the path
  b. Then the old path was duplicated
  c. And CoreUtils was added to the end of the path

So, the main advice here is to know that CoreUtils takes care of the path.

What comes now in this article is simply how to fix it if you did it.
 1. Back up the path
    reg export HKCU\Environment "%USERPROFILE%\path-backup.reg" /y
 
 2. De-duplicate the user path but still preserve the original order
    powershell -NoProfile -Command "$u=[Environment]::GetEnvironmentVariable('Path','User') -split ';' | ? {$_}; $m=[Environment]::GetEnvironmentVariable('Path','Machine') -split ';' | ? {$_}; $u=$u | ? {$_ -notin $m} | Select-Object -Unique; [Environment]::SetEnvironmentVariable('Path',($u -join ';'),'User')"

 3. Remove the coreutils that was added at the end of the path
    powershell -NoProfile -Command "$p=[Environment]::GetEnvironmentVariable('Path','User') -split ';' | ? { $_ -and $_ -ne 'C:\Program Files\coreutils' }; [Environment]::SetEnvironmentVariable('Path',($p -join ';'),'User')"

 4. Check the path
    echo %PATH%

In summary, when you install the Microsoft CoreUtils, it appends the 
coreutils to the path for you so you don't have to do it yourself.
-- 
The only people who don't make a mistake are those who don't do anything.

[toc] | [prev] | [next] | [standalone]


#195321

FromPaul <nospam@needed.invalid>
Date2026-08-28 15:37 -0400
Message-ID<116so1d$2ldf7$1@dont-email.me>
In reply to#195307
On Fri, 8/28/2026 12:25 PM, Maria Sophia wrote:
> Maria Sophia wrote:
>> Then we need to add coreutils to the Windows path
>>  C:\> setx PATH "%PATH%;C:\Program Files\coreutils"
>>       SUCCESS: Specified value was saved.
> 
> WARNING!
> 
> Drat. That was a mistake!
>   C:\> echo %PATH%
>        Reports coreutils, then stuff, the same stuff, and coreutils again
> 
> That setx method was the wrong method, but worse, it wasn't even needed!
> 
> Since the purpose of this thread is to be a public service announcement to 
> help others run Linux commands like "grep" on the CLI, notethat the setx 
> above duplicated the path, and worse, the winget of coreutils added the 
> coreutils to the BEGINNING of the path, so, the end result was:
>   a. CoreUtils was in the beginning of the path
>   b. Then the old path was duplicated
>   c. And CoreUtils was added to the end of the path
> 
> So, the main advice here is to know that CoreUtils takes care of the path.
> 
> What comes now in this article is simply how to fix it if you did it.
>  1. Back up the path
>     reg export HKCU\Environment "%USERPROFILE%\path-backup.reg" /y
>  
>  2. De-duplicate the user path but still preserve the original order
>     powershell -NoProfile -Command "$u=[Environment]::GetEnvironmentVariable('Path','User') -split ';' | ? {$_}; $m=[Environment]::GetEnvironmentVariable('Path','Machine') -split ';' | ? {$_}; $u=$u | ? {$_ -notin $m} | Select-Object -Unique; [Environment]::SetEnvironmentVariable('Path',($u -join ';'),'User')"
> 
>  3. Remove the coreutils that was added at the end of the path
>     powershell -NoProfile -Command "$p=[Environment]::GetEnvironmentVariable('Path','User') -split ';' | ? { $_ -and $_ -ne 'C:\Program Files\coreutils' }; [Environment]::SetEnvironmentVariable('Path',($p -join ';'),'User')"
> 
>  4. Check the path
>     echo %PATH%
> 
> In summary, when you install the Microsoft CoreUtils, it appends the 
> coreutils to the path for you so you don't have to do it yourself.
> 

There are also things which can be loaded, which are not in the path.
Having a path fixation, is not entirely an answer. The Metro.App could
quite well have a couple designated storage areas. And there could be
registry recording of "viable" executables. The permissions on Metro.App
storage, do not allow easy examination, but you can use nfi.exe to list
stuff like that. Some things that execute on Windows, are being located
via registry location storage.

For a lot of people, the contents of their PATH will be a puzzle for them,
as it's not an area people look at much any more. And since there are
so many install methods, you really cannot be sure that a given installer
does the right things for the job. A WinGet of a GREP package, the gnuwin32 one,
does that work ? You'd have to test whether the installation process
even proceeded in a logical manner. It's different when you know a developer
provided an installer for the job of doing that.

Curation of facilities on Windows has degraded to the level of poop.
The poor bastard working on the loader. I don't even know if there
is an authoritative and logically written description of how everything
loads, or what gubbins are needed to load stuff. If this is evolution,
its knuckles are dragging on the ground again. Throwing an undocumented
(repositories...) WinGet into the mix, that's just a sloppy icing
for our poop cake.

So while it's great to write lines of Powershell to do this and that,
this is not "teaching a man to fish". This is "giving him a fish".
We don't have a reliable treatise useful for teaching a man to fish.
If I asked an LLM-Ai to do this, it is quite possible it would
forget a few methods. And as you "have to know the answer" to trust
an LLM-AI screed, there's no guarantee of good coverage of the topic.

I would hope Microsoft keeps internal documents on the topic, but
who really knows. Otherwise, how would a new employee become familiar
with the labyrinth. Asking the person in the cubicle next to you,
is not considered a good usage of their time. And asking Raymond,
Raymond is busy. He's already shoving shit that should have been
shoveled years ago.

This is one of the differences at Apple. Historically, they had
"Inside Macintosh". The format and presentation, is preserved
in TN (Technical Notes). Some of the notes are fantastically good.
I wrote a partition manager once for my Mac disk, and I could
do that using a *single* TN, didn't have to read anything else.
(This was after gparted impressed me by utterly destroying the partition table.)
When they choose to document something, it's not a half hearted
effort on their part. The efforts are usually "better than Wikipedia"
level of technical notes. The way someone might explain a thing
to you in a USENET post. Whereas the Microsoft documentation
is unimaginative "the boss is beating me with a stick to write
this description" flavored documentation, the best kind of
documentation when you really needed charitably written material.

   Paul

[toc] | [prev] | [next] | [standalone]


#195343

From"Carlos E. R." <robin_listas@es.invalid>
Date2026-08-29 13:16 +0200
Message-ID<nfftd2F3glU1@mid.individual.net>
In reply to#195321
On 2026-08-28 21:37, Paul wrote:
> On Fri, 8/28/2026 12:25 PM, Maria Sophia wrote:
>> Maria Sophia wrote:


> This is one of the differences at Apple. Historically, they had
> "Inside Macintosh". The format and presentation, is preserved
> in TN (Technical Notes). Some of the notes are fantastically good.
> I wrote a partition manager once for my Mac disk, and I could
> do that using a *single* TN, didn't have to read anything else.
> (This was after gparted impressed me by utterly destroying the partition table.)
> When they choose to document something, it's not a half hearted
> effort on their part. The efforts are usually "better than Wikipedia"
> level of technical notes. The way someone might explain a thing
> to you in a USENET post. Whereas the Microsoft documentation
> is unimaginative "the boss is beating me with a stick to write
> this description" flavored documentation, the best kind of
> documentation when you really needed charitably written material.

I bought a book named something like "undocumented windows" long ago. 
That was w3.11, I think. Also the Programmers Reference, the User Guide 
and Reference for MsDos 5...

-- 
Cheers,
        Carlos E.R.
        ES🇪🇸, EU🇪🇺.

[toc] | [prev] | [next] | [standalone]


Page 5 of 6 — ← Prev page 1 2 3 4 [5] 6  Next page →

Back to top | Article view | alt.comp.os.windows-10


csiph-web