In DOS, how to include a Pipe | character to pipe it to CLIP

Started by april, April 06, 2022, 08:23:56 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

april

Thank you in advance for any help

I need to pipe some text to CLIP in a DOS batch file.  Problem I have is the text contains a PIPE character |.
For example, the text is abc|def.  I need the clipiboard to show abc|def as well.

Here's what I've tried so far without success.

echo abc|def|CLIP
The result is an error
'def' is not recognized as an internal or external command,
operable program or batch file.

echo abc^|def|CLIP
The result is an error
'def' is not recognized as an internal or external command,
operable program or batch file.

echo "abc|def"|CLIP
It kinda worked but the clipboard shows the text with the double quotes "abc|def"
I need the clipiboard to show abc|def

Please help.
Thank you.

Hackoo

You can give a try with this batch file :
@echo off
Title Get ClipBoard with Batch
echo ABC^|DEF^|GHI>"%Temp%\%~n0.txt"
Type "%Temp%\%~n0.txt" |Clip