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 545161
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T10:43:56+00:00 2026-05-13T10:43:56+00:00

I want to create a file named new text document.txt in the folder %tv%

  • 0

I want to create a file named “new text document.txt” in the folder %tv% using a batch file ( *.bat). This is my batch file:

set tv=D:\prog\arpack96\ARPACK\SRC
cd "%tv%"
@CON >> "new text document.txt"
set tv=

Although I can really create the file in %tv%, but when I run the above batch file, I will get an error message saying

‘ ‘ is not recognized as an internal
or external command, operable program
or batch file.

Is there anyway to get rid of this error message? Or I am creating the file using the wrong command?

  • 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-13T10:43:57+00:00Added an answer on May 13, 2026 at 10:43 am

    In order to get a truly empty file without having to provide user interaction, you can use the set /p command with a little trickery:

    set tv=c:\documents and settings\administrator
    cd "%tv%"
    <nul >"new text document.txt" (set /p tv=)
    

    The set /p asks the user for input into the tv variable after outputting the prompt after the = character.

    Since the prompt is empty, no prompt is shown. Since you’re reading from nul, it doesn’t wait for user interaction. And you can store the empty string straight into tv thus removing the need to unset it.


    Actually, after some more thought, there’s an easier way. I’ve used that set /p trick in the past since it’s the only way I know of echoing text without a newline being added (great for progress bars in the console). But if all you want is an empty file, you can probably get away with:

    copy /y nul "new text document.txt"
    

    The copy simply copies the contents of the nul device (effectively an empty file) to your new file name. The /y is to ensure it’s overwritten without bothering the user.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

i want to create new file iam using this code try { File file
I want to Create Text File of Crash Logs Information by ACRA Crash Report
Using C# and WinForms in VS2008, I want to create a file browser control
I want to create a CSV file from our Sage Abra Suite database using
I want to create a .wav file in Python using the numpy and scipy
I'm new to Windows batch files, but I'm writing a .bat file that just
I want to create a file and give it to download without putting itself
I want to create a file in the current directory (where the executable is
I want to create log file for my flex application. That is the file
I have C# Dictionary and I want create a .csv file from it. For

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.