Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9202411
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T23:15:08+00:00 2026-06-17T23:15:08+00:00

How do i echo a paragraph into a file without doing any kind of

  • 0

How do i echo a paragraph into a file without doing any kind of manipulation to the paragraph.
i mean newline,space,special characters etc and all the indentation should be same.

My .bat file(containing the contents of .ppk file)

    echo (PuTTY-User-Key-File-2: ssh-rsa
Encryption: none
Comment: rsa-key-20130127
Public-Lines: 6
AAAAB3NzaC1yc2EAAAABJQAAAQBVYEVYbGluh1Ne6psUMsK4TRiqwN8GG+ImbsfC
qIYje3S7n3owtEUSDMEc5VvTZTEXk/CKHK6tXhGSNrExXKDhKE2HejY7TFtbc3vU
KM4OogxYeZs/0yBX/kVEu5+kIeZ0ZEsq/ve9/hnEVLZ3DFotUoDzzwdd4jAHUZv2
08xk5tTxodh+iO26RVPSaklZrFjbZkqCwPOnVZhK6JqE/7kZyIM+p5W8CH8XPG3r
fgU/R4BpwMNz+pYo2iiV3eZApI25lY+IcjclA5Amx1JdCM1zIvA6C8ABUbTMXsyG
RHkzdEYjw5+pBF8qLU8s8+M9sw0l5z58dP9t+vuYWz+JrsmL
Private-Lines: 14
AAABAECb4XNY9dcaTO3h+NED0aA6V9sqLDv5bN7QX9GUSdWpiMVWF0dzqeQlU96E
DiNvLBHXvPLlRer7FDdL+7am9kmGSIIy+JuTusG/LUaba4Cx+4E5bpEqJlBtZNoR
ceP9+oGYAYhSPvCkneCuz0VVdKytI1C4WJoS8+nc5LrJyxvsFGgVEIo5nadkABRV
eOLwotq2Mj/lLXHMbE5lB+9m9VNsWrBErNVCwNQdhQOyG1E39YcwBV+hB+Pyu41z
6EHxIRXQvbYNE2HjLvowrnX/9fFfx1kf51+WE+VbFQxrrZqE1p3y2S2kJkAopRio
KZBlNwrR6mwSLtRn4a6ZecKwVE0AAACBAJVV6O5leR0gl27DVqnXu6mhf6Xb8Ije
2JfvLCa73bgpFSYQ2EpxKTiSpZpM3kPpnC7Y0SvigstGHwze/OuCXYnzT/KDkBrs
NDPiuTSmzW3JxtGv1axpfRRt/PaRIHq6pCtyGxIc5A0RrTuSrPzZkHxFggkAYSMK
9YOi1sZhcVtlAAAAgQCSW1Pvq4zSjsUuGMc/w8T8mOOZG4Yllq7e9CSpTMeqeVHl
Vytm5+ujIyas/k/UGA8WQt3ZnD5uLF7tBRoaHf88oE00nXVnLlDeME3Jdbts84tE
1HB9RzwGE+BVknEiNcUjqhVcRqv6+pOClR+K5VOstqs/tmmMOA57c1481K/aLwAA
AIAQn9Fhg4Ih71uvber4RELcZCQrvRFsuASYHrgYBkzw17PTPQ9APv0B1nIPZ/u6
+jhou7qzR78yrYw0Po4ZJmmDt0CP/cZPWL4jQ6sM6on98D6TdKk7rE1c0WPn1Bta
ZtaxQqOku7eAfw745L9EjokekZjohjTFI9rSFdsCfa6dXw==
Private-MAC: 2e75877ab827b492b2a0a16c5019cd45f96e4990) > myfile.txt

The above line does not work after i save it as .bat and execute

i want to put the paragraph in a file with a unique name so that it does not overwrite any existing file.
Do i need to echo at each and every line and keep appending.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T23:15:09+00:00Added an answer on June 17, 2026 at 11:15 pm

    Put a unique text marker after the final EXIT /B, followed by your paragraph. Use FOR /F with FINDSTR to locate the unique marker, and then use a FOR /F loop to process all the lines after the marker.

    There are many variations, each with different limitations.

    Here is the simplest form, but it also has the most limitations. The limitations are described in the text.

    @echo off
    setlocal disableDelayedExpansion
    set "skip="
    for /f "delims=:" %%N in (
      'findstr /x /n ":::BeginText" "%~f0"'
    ) do if not defined skip set skip=%%N
    >test.txt (
      for /f "usebackq skip=%skip% delims=" %%A in ("%~f0") do echo(%%A
    )
    type test.txt
    exit /b
    
    :::BeginText
    This text will be exactly preserved with the following limitations:
    
      1) Each line will be terminated by CR LF even if original has only LF.
    
      2) Lines are limited in length to approximately 8191 bytes.
    
      3) Empty lines will be stripped.
    
    ; 4) Lines beginning with ; will be stripped.
    
      5) The text will be truncated at the first occurance of hex code 0x1A (Ctrl-Z).
    
    Special characters like ^ & < > | etc. do not cause a problem
    

    Some odd FOR /F option syntax removes the limitation on lines beginning with ;

    @echo off
    setlocal disableDelayedExpansion
    set "skip="
    for /f "delims=:" %%N in (
      'findstr /x /n ":::BeginText" "%~f0"'
    ) do if not defined skip set skip=%%N
    >test.txt (
      for /f ^usebackq^ skip^=%skip%^ delims^=^ eol^= %%A in ("%~f0") do echo(%%A
    )
    type test.txt
    exit /b
    
    :::BeginText
    This text will be exactly preserved with the following limitations:
    
      1) Each line will be terminated by CR LF even if original has only LF.
    
      2) Lines are limited in length to approximately 8191 bytes.
    
      3) Empty lines will be stripped.
    
      4) The text will be truncated at the first occurance of hex code 0x1A (Ctrl-Z).
    
    Special characters like ^ & < > | etc. do not cause a problem
    ;Lines beginning with ; are preserved
    

    Reading FINDSTR /N output instead of reading the file directly preserves empty lines. But a new limitation with leading : is introduced.

    @echo off
    setlocal disableDelayedExpansion
    set "skip="
    for /f "delims=:" %%N in (
      'findstr /x /n ":::BeginText" "%~f0"'
    ) do if not defined skip set skip=%%N
    >test.txt (
      for /f "skip=%skip% tokens=1* delims=:" %%A in (
       'findstr /n "^" "%~f0"'
      ) do echo(%%B
    )
    type test.txt
    exit /b
    
    :::BeginText
    This text will be exactly preserved with the following limitations:
    
      1) Each line will be terminated by CR LF even if original has only LF.
    
      2) Lines are limited in length to approximately 8191 bytes.
    
    :::  3) Leading : will be stripped from each line.
    
    Special characters like ^ & < > | etc. do not cause a problem
    Empty lines are preserved!
    ;Lines beginning with ; are preserved.
    

    This final version is about as good as it gets. Delayed expansion must be toggled on and off to preserve ! that may appear in the text.

    @echo off
    setlocal disableDelayedExpansion
    set "skip="
    for /f "delims=:" %%N in (
      'findstr /x /n ":::BeginText" "%~f0"'
    ) do if not defined skip set skip=%%N
    >test.txt (
      for /f "skip=%skip% tokens=*" %%A in (
       'findstr /n "^" "%~f0"'
      ) do (
        set "line=%%A"
        setlocal enableDelayedExpansion
        echo(!line:*:=!
        endlocal
      )
    )
    type test.txt
    exit /b
    
    :::BeginText
    This text will be exactly preserved with the following limitations:
    
      1) Each line will be terminated by CR LF even if original has only LF.
    
      2) Lines are limited in length to approximately 8191 bytes.
    
    Special characters like ^ & < > | etc. do not cause a problem.
    Empty lines are preserved!
    ;Lines beginning with ; are preserved.
    :::Leading : are preserved.
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have this function which cuts a string into a number of characters without
When echo ing to a file. echo is printing extra tabs before what is
I want to convert line breaks into paragraphs. For instance $string = 1st paragraph
$i = 1 echo ' <p class=paragraph$i> </p> ' ++i Trying to insert a
I am downloading HTML files (raw HTML without any !DOCTYPE...) from a government website
I'm trying to breakdown a paragraph, retrieved from a database array, into separate words.
I executed C-x M-k to kill a paragraph in Emacs. The echo area showed
echo date('H:i', time()); // 10:15 echo date('H:i', strtotime($this->deadline)); // 10:05 $delay = time() -
echo timezone_name_from_abbr(, 3600*7, 0); //ok echo timezone_name_from_abbr(, 3600*8, 0); //NOT ok! return nothing! echo
echo date(w,strtotime(date(Y-m-d))); echo date(w,strtotime(date(Y年m月d日))); Save it as utf8.You'll see the second is bigger than

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.