Thread View: alt.comp.os.windows-10
11 messages
11 total messages
Started by Johann 'Myrkraverk' Oskarsson
Fri, 27 Nov 2026 05:06
What does |> do?
Author: Johann 'Myrkraverk' Oskarsson
Date: Fri, 27 Nov 2026 05:06
Date: Fri, 27 Nov 2026 05:06
32 lines
2135 bytes
2135 bytes
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
Re: What does |> do?
Author: R.Wieser
Date: Fri, 27 Nov 2026 07:33
Date: Fri, 27 Nov 2026 07:33
15 lines
1610 bytes
1610 bytes
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
Re: What does |> do?
Author: Paul
Date: Fri, 27 Nov 2026 09:28
Date: Fri, 27 Nov 2026 09:28
52 lines
2561 bytes
2561 bytes
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
Re: What does |> do?
Author: R.Wieser
Date: Fri, 27 Nov 2026 10:00
Date: Fri, 27 Nov 2026 10:00
10 lines
1417 bytes
1417 bytes
Paul, > It looks like a .bat file or something :-) It does, doesn't it ? :-p Regards, Rudy Wieser.
Re: What does |> do?
Author: JJ
Date: Fri, 27 Nov 2026 18:04
Date: Fri, 27 Nov 2026 18:04
49 lines
3037 bytes
3037 bytes
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)>
Re: What does |> do?
Author: J. P. Gilliver
Date: Fri, 27 Nov 2026 21:30
Date: Fri, 27 Nov 2026 21:30
34 lines
2562 bytes
2562 bytes
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.
Re: What does |> do?
Author: Paul
Date: Sat, 28 Nov 2026 02:34
Date: Sat, 28 Nov 2026 02:34
119 lines
5915 bytes
5915 bytes
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
Re: What does |> do?
Author: R.Wieser
Date: Sat, 28 Nov 2026 09:37
Date: Sat, 28 Nov 2026 09:37
22 lines
2003 bytes
2003 bytes
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
Re: What does |> do?
Author: J. P. Gilliver
Date: Sat, 28 Nov 2026 14:33
Date: Sat, 28 Nov 2026 14:33
56 lines
3842 bytes
3842 bytes
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.
Re: What does |> do?
Author: Paul
Date: Sat, 28 Nov 2026 15:21
Date: Sat, 28 Nov 2026 15:21
61 lines
4038 bytes
4038 bytes
On Sat, 11/28/2026 9:33 AM, J. P. Gilliver wrote: > 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.) > I wonder how many microwave noodles the machine has eaten. It's funny for it to be an authority on cooking, when it hasn't eaten anything. Paul
Re: What does |> do?
Author: Johann 'Myrkraverk' Oskarsson
Date: Sun, 29 Nov 2026 02:02
Date: Sun, 29 Nov 2026 02:02
96 lines
4495 bytes
4495 bytes
On 11/28/2026 2:04 AM, JJ wrote: > 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)> Thank you, and everyone who commented on this thread. This is what I eventually came up with. Chances are I don't need this, and can just use %~1 unconditionally, but this was mildly fun to figure out. I added a license since some people are sticklers about that for public code. Feel free to adjust as needed. I just call it tvconv.bat, and put it in my %PATH%. There are some obvious bugs that hinder usability in the general, but I am not fixing those until I run into them myself. Best wishes, and happy batch files. @ECHO off REM Author, Johann "Myrkraverk" Oskarsson. REM Initial version. November 29, 2026. License: WTFPL 2.0. REM Setlocal is to make sure environment variables are local. SETLOCAL REM Test if the argument starts with ", and treat it accordingly. ECHO %1 | FINDSTR /b /r \" > nul IF errorlevel 1 GOTO doublequote REM Otherwise, we assume no quote in the argument. SET "output=%~n1.mp4" SET "input=%1" GOTO ffmpeg :doublequote REM The ~ also removes double quotes, so use it. SET "output=%~n1.mp4" SET "input=%~1" :ffmpeg REM The following ffmpeg command line works for Samsung TVs. REM I haven't documented each parameter yet. SET ffmpeg=-c:v libx264 -crf 23 -pix_fmt yuv420p -c:a aac -b:a 192k FFMPEG -i "%input%" %ffmpeg% "%output%" -- 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
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads