Create file command in batch files (* .bat)

I want to create a file called "new text document.txt" in a 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 actually create the file in %tv%, but when I run the above batch file, I get an error message

'' is not recognized as an internal or external command, an existing program, or a batch file.

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

+2
source share
4 answers

, set /p :

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

set /p tv =.

, . nul, . tv, .


, , . set /p , , ( ). , , , , , :

copy /y nul "new text document.txt"

copy nul ( ) . /y , , .

+6

*.bat - .

echo off > test.txt
+4
type nul > file.txt

file.txt

paxdiablo answer

+3

con - Windows, .

copy con → filename.txt

, , Ctrl Z.

0

Source: https://habr.com/ru/post/1738998/


All Articles