Computer Hope

Microsoft => Microsoft DOS => Topic started by: april on April 06, 2022, 08:23:56 AM

Title: In DOS, how to include a Pipe | character to pipe it to CLIP
Post by: april on April 06, 2022, 08:23:56 AM
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.
Title: Re: In DOS, how to include a Pipe | character to pipe it to CLIP
Post by: Hackoo on June 09, 2022, 04:25:16 PM
You can give a try with this batch file :
Code: [Select]
@echo off
Title Get ClipBoard with Batch
echo ABC^|DEF^|GHI>"%Temp%\%~n0.txt"
Type "%Temp%\%~n0.txt" |Clip