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

  • SEARCH
  • Home
  • 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 3841446
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 19, 20262026-05-19T15:39:16+00:00 2026-05-19T15:39:16+00:00

I tried to copy one file to another from starting line upto a limit.

  • 0

I tried to copy one file to another from starting line upto a limit. ie.,
line 1 to 10(file1.txt)->file2.txt
but while writing “!” is skipped. what can i do for to solve it. Any help will be thankful.

The loop for that function is given below.

%NF%-> new file.

%EF%-> existing file

%1% -> line number(passed from another part)

:_doit

findstr /N /R "." %EF%|findstr /B /C:"%1:">nul

if errorlevel 1 (    
    echo. >>%NF%        
) else (    
    for /f "tokens=1 delims=" %%a in ('findstr /N /R "." %EF%^|findstr /B /C:"%1:"') do (    
        if [%%a] EQU [] (    
            echo. >>%NF%    
        ) else (    
            echo %%a >>%NF%    
       )     
   )
)
  • 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-05-19T15:39:17+00:00Added an answer on May 19, 2026 at 3:39 pm
    if errorlevel 1 ( 
        echo. >>%NF% 
    ) else ( 
        for /f "tokens=1 delims=" %%a in ('findstr /N /R "." %EF%^|findstr /B /C:"%1:"') do ( 
           if [%%a] EQU [] ( 
              echo. >>%NF% 
           ) else( 
              setlocal DisableDelayedExpansion 
              echo %%a >>%NF%
              endlocal
           ) 
        )
    )
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I tried to copy a file from one linux server to another Linux server
I tried to copy and paste a component from one data module into another
I am trying to copy a file from one location to another( in a
in my android application I want to copy file from one directory to another
I tried to make an independent copy of an array but couldnt get one.
How can I create an empty file at the DOS/Windows command-line? I tried: copy
I tried to copy any dir from my server to client's pc but i
I need to move or copy a simple text file from one web site
I'm trying to use ANT to copy files from one directory to another directory
I am trying to copy an SPListItem (with file) from one site collection to

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.