Article View: alt.comp.os.windows-10
Article #1501Re: What does |> do?
From: 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
Technical Details
Message-ID:
<uILOS.64953$t1%f.51134@fx11.ams4>Path:
mbox-mo1.pugleaf.net!srv.newsdeef.eu!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!peer04.iad!feed-me.highwinds-media.com!news.highwinds-media.com!peer02.ams1!peer.ams1.xlned.com!news.xlned.com!fx11.ams4.POSTED!not-for-mailReferences:
<Sd8OS.7158$B3F4.2353@fx15.ams4> <5p4fj198n47w$.rl2a4bctfz97$.dlg@40tude.net>Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!srv.newsdeef.eu!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!peer04.iad!feed-me.highwinds-media.com!news.highwinds-media.com!peer02.ams1!peer.ams1.xlned.com!news.xlned.com!fx11.ams4.POSTED!not-for-mail MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: What does |> do? Newsgroups: alt.comp.os.windows-11,alt.comp.os.windows-10 References: <Sd8OS.7158$B3F4.2353@fx15.ams4> <5p4fj198n47w$.rl2a4bctfz97$.dlg@40tude.net> Content-Language: en-US From: Johann 'Myrkraverk' Oskarsson <johann@myrkraverk.invalid> Organization: Watcom Pro Ltd. In-Reply-To: <5p4fj198n47w$.rl2a4bctfz97$.dlg@40tude.net> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Lines: 96 Message-ID: <uILOS.64953$t1%f.51134@fx11.ams4> X-Complaints-To: abuse@easynews.com X-Complaints-Info: Please be sure to forward a copy of ALL headers otherwise we will be unable to process your complaint properly. Date: Sun, 29 Nov 2026 10:02:00 +0800 X-Received-Bytes: 4268