|
Answer» Helo everybody
I have one question.
How can I create empty file via command line in MSDOS ?
Thanks
Code: [SELECT]copy con "(where-ever i.e. C:\)"\(file name).(file TYPE) E.G. copy con "C\Documents and Settings\%username%\Desktop\file.txt"but I dont want to open console for editing, only create empty file with 0 bytes.
If you want a really empty file (0 bytes) then do REM>MyFileName.Ext
GrahamCode: [Select]cd (where-ever you want the files to go) copy con (file name).(file type) E.G. cd "C:\Documents and Settings\%username%\Desktop" copy con file1.txt copy con file2.txt copy con file3.txt There is probably another way to automatically add a number to the file, but I don't know it.
N.B. You have to press ^Z to create the file e.g. copy con (file thing here) (press this now:)^Z (shift-Z)Code: [Select]echo.>> "%userprofile%\desktop\hi.txt" see if that worksDoesn't >> add text to the file though?Hello
I THINK that REM command RECORDS commnet. I tried it but i don't show any file
echo command puts two character into file, result of echo.>file.txt is file with 2 bytes
Metalpalo type nul > Drive:\Folder\Filename.Extension
Code: [Select]I:\test\zzz>type nul > zero.txt
I:\test\zzz>dir Volume in drive I is Various Volume Serial Number is 4040-A645
Directory of I:\test\zzz
04/05/2007 11:32 <DIR> .. 04/05/2007 11:32 <DIR> . 04/05/2007 11:32 0 zero.txt 1 File(s) 0 bytes 2 Dir(s) 24,466,706,432 bytes free Sorry guys, rem>filename is a trick that no longer works (Im afraid I go back to DOS 2 days)
The type NUL trick does WORK though Graham
|