I want to create new file and to add info in it. But at the beginning I want to clear all its information. So I wrote:
@if "%DEBUG%" == "" @echo off
@rem ############################################
@rem # Create new empty file #
@rem ############################################
:setup
if "%OS%"=="Windows_NT" setlocal
SetLocal EnableDelayedExpansion
goto create
:create
@cmd /c echo( >%temp%\hosts
goto end
:end
if "%OS%"=="Windows_NT" endlocal
PAUSE
But when I open the file there is leading empty line
<empty line>
SomeInfo
Where is just empty line. How to create new file with no leading empty line?
break>empty.file
My favorite way..
Break is an internal command so it is fast.And almost allays produces empty output (he only exception is /?
) no matter of the arguments , which reduces the chance of errors. And never does changes to the environment.