• What does |> do?

    From Johann 'Myrkraverk' Oskarsson@johann@myrkraverk.invalid to alt.comp.os.windows-11,alt.comp.os.windows-10 on Fri Nov 27 13:06:56 2026
    From Newsgroup: alt.comp.os.windows-10

    Dear alt.comp.os.windows-11,
    alt.comp.os.windows-10,

    What does the |> do in command lines? I don't recall learning that dur-
    ing my DOS days. I saw it here,


    https://stackoverflow.com/questions/15707742/windows-batch-check-if-variable-starts-with-ends-with-and-contains-a-specific-s

    and I was working out how I'd check if an environment variable, really
    %1, started with a double quote -- " -- and

    findstr /b /r \"

    seems to do the trick, but the surrounding code is -- escaping me. I
    haven't done anything like a mildly complex batch file since the 90s, so
    please be patient with me.

    Basically, what I thought I should do, was to check if the incoming %1
    started with ", and then set it without, or set it as foo="%1" if not.

    It doesn't have to perfect, just something that'll help me remember com-
    plex ffmpeg lines.


    Best wishes, and happy batch files!
    --
    Johann | email: invalid -> com | http://www.myrkraverk.com/blog/
    I'm not from the Internet, I just work there. | via Easynews.com https://bsky.app/profile/myrkraverk.bsky.social | for ( ;; ) _:;
    Federated at https://fed.brid.gy/bsky/myrkraverk.bsky.social

    --- Synchronet 3.21e-Linux NewsLink 1.2
  • From R.Wieser@address@is.invalid to alt.comp.os.windows-11,alt.comp.os.windows-10 on Fri Nov 27 08:33:17 2026
    From Newsgroup: alt.comp.os.windows-10

    Johan,

    What does the |> do in command lines?

    The "|" redirects the output of the previous command (echo) to the next one, the ">" redirect the output of the command it belongs to (in your case the next one, findstr),

    Yes, the "<" and ">" may be used /before/ the command you want to redirect
    the input for and/or output of.

    Regards,
    Rudy Wieser


    --- Synchronet 3.21e-Linux NewsLink 1.2
  • From Paul@nospam@needed.invalid to alt.comp.os.windows-11,alt.comp.os.windows-10 on Fri Nov 27 04:28:19 2026
    From Newsgroup: alt.comp.os.windows-10

    On Fri, 11/27/2026 2:33 AM, R.Wieser wrote:
    Johan,

    What does the |> do in command lines?

    The "|" redirects the output of the previous command (echo) to the next one, the ">" redirect the output of the command it belongs to (in your case the next one, findstr),

    Yes, the "<" and ">" may be used /before/ the command you want to redirect the input for and/or output of.

    Regards,
    Rudy Wieser



    @echo off
    setlocal
    set test1=abc
    set test2="abc"
    set test3="")
    set test4=")"
    set test5=abc")"
    set test6=xyzBETAzyx
    set test7="xyz BETA zyx"
    set test8=xyzBETAzyx")"
    set test9=xyzBETAzyx")"
    set test10="xyzbetazyx")
    set test11="xyzBETAzyx")

    for /l %%N in (1 1 11) do call :test test%%N
    exit /b

    :test variableName
    setlocal enableDelayedExpansion
    echo !%1!|>nul findstr /rx \".*BETA.*\") && set "result=PASS" || set "result=FAIL"
    echo %1 = !result!: !%1!
    exit /b

    ************************************************

    The >nul sends the STDOUT of findstr to the bit bucket.
    The bat scriptor doesn't want it nearer the end where all
    that crap is located.

    The pipe symbol, pipes the STDOUT of the first command (which echoes
    a string) and it becomes the STDIN to findstr.

    It looks like a .bat file or something :-)

    Paul
    --- Synchronet 3.21e-Linux NewsLink 1.2
  • From R.Wieser@address@is.invalid to alt.comp.os.windows-11,alt.comp.os.windows-10 on Fri Nov 27 11:00:59 2026
    From Newsgroup: alt.comp.os.windows-10

    Paul,

    It looks like a .bat file or something :-)

    It does, doesn't it ? :-p

    Regards,
    Rudy Wieser.


    --- Synchronet 3.21e-Linux NewsLink 1.2
  • From JJ@jj4public@gmail.com to alt.comp.os.windows-11,alt.comp.os.windows-10 on Sat Nov 28 01:04:28 2026
    From Newsgroup: alt.comp.os.windows-10

    On Fri, 27 Nov 2026 13:06:56 +0800, Johann 'Myrkraverk' Oskarsson wrote:
    Dear alt.comp.os.windows-11,
    alt.comp.os.windows-10,

    What does the |> do in command lines? I don't recall learning that dur-
    ing my DOS days. I saw it here,


    https://stackoverflow.com/questions/15707742/windows-batch-check-if-variable-starts-with-ends-with-and-contains-a-specific-s

    and I was working out how I'd check if an environment variable, really
    %1, started with a double quote -- " -- and

    findstr /b /r \"

    seems to do the trick, but the surrounding code is -- escaping me. I
    haven't done anything like a mildly complex batch file since the 90s, so please be patient with me.

    Basically, what I thought I should do, was to check if the incoming %1 started with ", and then set it without, or set it as foo="%1" if not.

    It doesn't have to perfect, just something that'll help me remember com-
    plex ffmpeg lines.

    Best wishes, and happy batch files!

    In CMD, these special characters are basically command separators, where ||
    and && are conditional command separators:
    |, &, ||, &&

    So, a command line like below:
    set |>nul bbb && ccc || ddd

    It's consist of 4 preceived command lines:
    aaa
    nul bbb
    ccc
    ddd

    < and > redirections can be at start or at end of a command line, or both.

    Further readings: (long URL warning)

    Command shell overview <https://learn.microsoft.com/en-us/previous-versions/windows/it-pro/windows-xp/bb490954(v=technet.10)>

    Using command redirection operators <https://learn.microsoft.com/en-us/previous-versions/windows/it-pro/windows-xp/bb490982(v=technet.10)>
    --- Synchronet 3.21e-Linux NewsLink 1.2
  • From J. P. Gilliver@G6JPG@255soft.uk to alt.comp.os.windows-11,alt.comp.os.windows-10 on Fri Nov 27 21:30:41 2026
    From Newsgroup: alt.comp.os.windows-10

    On 2026/11/27 5:6:56, Johann 'Myrkraverk' Oskarsson wrote:
    []
    It doesn't have to perfect, just something that'll help me remember com-
    plex ffmpeg lines.


    Best wishes, and happy batch files!

    I was trying to write a batch file incorporating yt-dlp, and I asked one
    of the AIs - either ChatGPT or the Google one, I can't remember - some
    fine point.

    It said something like "Would you like me to create the batch file for
    you?".

    I said yes, fully intending to examine and tweak the code.

    But I was very impressed with what it created: not only did the code do
    what I wanted, but it was to a standard that pleased me: nicely
    indented, with comments - not too many, not too few.

    Twenty years ago I might have done battle myself with the complexities
    of yt-dlp and ffmpeg. (Well, I'd have had to, as AIbots weren't around.
    But I _think_ I might have anyway.) But now, (a) at my age (b) since AI
    _is_ around, I'm happy to let it! It knew special characters - what I
    wanted didn't involve |>, but I learnt "^" for breaking a line to make
    it more reasonable, which I hadn't known about.

    It even, once I'd got what I wanted, asked "would you like me to modify
    the batch to ...", with sensible suggestions!
    --
    J. P. Gilliver. UMRA: 1960/<1985 MB++G()ALIS-Ch++(p)Ar++T+H+Sh0!:`)DNAf

    If it's not on fire, it's a software problem.
    --- Synchronet 3.21e-Linux NewsLink 1.2
  • From Paul@nospam@needed.invalid to alt.comp.os.windows-11,alt.comp.os.windows-10 on Fri Nov 27 21:34:27 2026
    From Newsgroup: alt.comp.os.windows-10

    On Fri, 11/27/2026 4:30 PM, J. P. Gilliver wrote:
    On 2026/11/27 5:6:56, Johann 'Myrkraverk' Oskarsson wrote:
    []
    It doesn't have to perfect, just something that'll help me remember com-
    plex ffmpeg lines.


    Best wishes, and happy batch files!

    I was trying to write a batch file incorporating yt-dlp, and I asked one
    of the AIs - either ChatGPT or the Google one, I can't remember - some
    fine point.

    It said something like "Would you like me to create the batch file for
    you?".

    I said yes, fully intending to examine and tweak the code.

    But I was very impressed with what it created: not only did the code do
    what I wanted, but it was to a standard that pleased me: nicely
    indented, with comments - not too many, not too few.

    Twenty years ago I might have done battle myself with the complexities
    of yt-dlp and ffmpeg. (Well, I'd have had to, as AIbots weren't around.
    But I _think_ I might have anyway.) But now, (a) at my age (b) since AI
    _is_ around, I'm happy to let it! It knew special characters - what I
    wanted didn't involve |>, but I learnt "^" for breaking a line to make
    it more reasonable, which I hadn't known about.

    It even, once I'd got what I wanted, asked "would you like me to modify
    the batch to ...", with sensible suggestions!


    There are other outcomes possible.

    The most extreme answer it will give is:

    "Why don't you do your own homework ?"

    And when you look at a question, it's hard
    to tell which queries could trigger that. I
    only got that reply once.

    When it writes code, most of the time it gives
    no build instructions. When I write my 60 line
    program in one file, I put this as a comment
    near the top.

    gcc -o askmeaquestion.exe askmeaquestion.c

    You can make a second query, right after the
    code was written, and it can tell you how
    to run a thing. Assuming you tell it what
    your environment is. Maybe if I was multiplying
    two very large numbers together, I might need
    a library.

    sudo apt install gmp-dev

    gcc -o askmeaquestion askmeaquestion.c -lgmp

    You would have to tell it which Linux distro you
    were on, so it could pick the right module names.
    The developer packages, might have a library with
    a libgmp.so or a libgmp.dll and so on.

    If you keep the query window open, and you ask
    three questions, the context on the third question
    consists of "1 2 3". All the questions are still
    there. If you close the query window, the datacenter
    version may clear context memory. When you run a
    model on your own computer, you can see on the left
    hand side, there is context stored in your "project"
    and you can clear that when you feel like it, and
    that could make your next query (at home) run faster
    on your weak hardware :-) If you close the model runner
    in Windows, it still has "1 2 3" stored for the next
    time you start and operate the model-runner program.
    The purpose of keeping context, is for answering
    long running conversations properly.

    The text hole is intended to coerce users to keep
    the input token count low. However, you can open
    Notepad, write three paragraphs of program requirements,
    and simply paste that into the box, then use the up-arrow
    icon on the right. And it will then eat all that input.
    ______________________________
    / \ ^
    / List the USA Presidents. \ |
    \________________________________/

    On one which is slightly agentic and has some multimedia
    capability, you can do this, and where I have placed the
    * (no, you don't type that character), you can use your
    mouse cursor and select Paste from the context menu. You
    can paste an image file right into the dialog. In File Explorer,
    you copy input.png, then paste it where the asterisk is.
    An image icon may appear near the spot you did the paste,
    as recognition the runner understands the construct.
    ______________________________
    / \ ^
    / Could you OCR this for me ? * \ |
    \________________________________/

    Did I read a manual to find that out ? Nope. I
    was frustrated, the machine was giving me some
    bad instructions and I figured "well, nothing to
    lose, let's try a paste" and it accepted that. When
    you ask for OCR, in a second sentence "please
    give an exact verbatim copy of the text", or it
    won't do the right thing without that!

    Could you OCR an image file for me ?
    Please give an exact verbatim copy
    of the text contained in this file *

    And it will make the usual sloppy mess. Nobody is perfect.

    Paul
    --- Synchronet 3.21e-Linux NewsLink 1.2
  • From R.Wieser@address@is.invalid to alt.comp.os.windows-11,alt.comp.os.windows-10 on Sat Nov 28 10:37:50 2026
    From Newsgroup: alt.comp.os.windows-10

    Paul,

    The most extreme answer it will give is:

    "Why don't you do your own homework ?"

    I for one have been known to, effectivily, say the same a few times. As an AI is taught by scraping the whole of the internet I'm quite sure that it caught such (mine and others) responses too

    But yes, its funny that an AI, which very purpose is to help people with /whatever/ they ask (including murdering people, which is highly illegal all over the world), tells you to do your own (home)work.

    And its ofcourse a good indicator that those AI's have /no idea/ what they
    are responding with. The blurb has a high "match" score, so it must be what we want to hear.

    Regards,
    Rudy Wieser


    --- Synchronet 3.21e-Linux NewsLink 1.2
  • From J. P. Gilliver@G6JPG@255soft.uk to alt.comp.os.windows-11,alt.comp.os.windows-10 on Sat Nov 28 14:33:42 2026
    From Newsgroup: alt.comp.os.windows-10

    On 2026/11/28 2:34:27, Paul wrote:
    On Fri, 11/27/2026 4:30 PM, J. P. Gilliver wrote:
    On 2026/11/27 5:6:56, Johann 'Myrkraverk' Oskarsson wrote:
    []
    It doesn't have to perfect, just something that'll help me remember com- >>> plex ffmpeg lines.


    Best wishes, and happy batch files!

    I was trying to write a batch file incorporating yt-dlp, and I asked one
    of the AIs - either ChatGPT or the Google one, I can't remember - some
    fine point.

    It said something like "Would you like me to create the batch file for
    you?".

    I said yes, fully intending to examine and tweak the code.

    But I was very impressed with what it created: not only did the code do
    what I wanted, but it was to a standard that pleased me: nicely
    indented, with comments - not too many, not too few.

    Twenty years ago I might have done battle myself with the complexities
    of yt-dlp and ffmpeg. (Well, I'd have had to, as AIbots weren't around.
    []
    There are other outcomes possible.[lots of doubtless good stuff snipped.]

    Remember Johann was just trying to "remember com-
    plex ffmpeg lines."

    My point was just that where the requirement is to write a batch file
    involving ffmpeg - which I guessed might be what Johann was trying to do
    - AI might produce it for you; the various switches to ffmpeg (and, in
    my case, yt-dlp) are complex, and not (for me) at all easily remembered,
    and the AI produced a batch file that did what I wanted, also taking
    care - with local variables - of filename work; and did it all neatly
    laid out and commented, so I could see some idea what switches it was
    using and why. And the enhancements _it_ suggested were good suggestions.

    Yes, I did glance through the code to see if it did anything horrendous
    - like format C:, or start WWIII - and did test the batch.

    Yes, if you ask for more philosophical things, like solve the housing
    crisis or world poverty, ... but just something like a batch file to do something with (for example) ffmpeg, it's pretty good. Or teeling me how
    to microwave noodles, or why instructions say "hot but not boiling", or ...

    Though having said all that, next time I am chatting to it, if I
    remember, I /will/ ask it what the answer is to life, the universe, and everything - and I'll be most chuffed if it gives the answer I know!
    (No, I won't then go on to ask it what the question was.)
    --
    J. P. Gilliver. UMRA: 1960/<1985 MB++G()ALIS-Ch++(p)Ar++T+H+Sh0!:`)DNAf

    Old professors don't fade away - they just lose their faculties.
    --- Synchronet 3.21e-Linux NewsLink 1.2