07-23-2023, 09:34 AM
An easy way to replace the touch command on a windows command line like cmd would be:
type nul > your_file.txt
This will create 0 bytes in the `your_file.txt` file.
This would also be a good solution to use in windows batch files.
Another way of doing it is by using the [echo][1] command:
echo.> your_file.txt
echo. - will create a file with one empty line in it.
---
If you need to preserve the content of the file use `>>` instead of `>`
> Creates a new file
>> Preserves content of the file
Example
type nul >> your_file.txt
---
You can also use [call][2] command.
> Calls one batch program from another without stopping the parent batch program. The call command accepts labels as the target of the call.
Example:
call >> your_file.txt
[1]:
or even if you don't want make it hard you can Just install [Windows Subsystem for Linux][1] (WSL). Then, type.
wsl touch
or
wsl touch textfilenametoedit.txt
Quotes are not needed.
[1]:
type nul > your_file.txt
This will create 0 bytes in the `your_file.txt` file.
This would also be a good solution to use in windows batch files.
Another way of doing it is by using the [echo][1] command:
echo.> your_file.txt
echo. - will create a file with one empty line in it.
---
If you need to preserve the content of the file use `>>` instead of `>`
> Creates a new file
>> Preserves content of the file
Example
type nul >> your_file.txt
---
You can also use [call][2] command.
> Calls one batch program from another without stopping the parent batch program. The call command accepts labels as the target of the call.
Example:
call >> your_file.txt
[1]:
[To see links please register here]
[2]:[To see links please register here]
---or even if you don't want make it hard you can Just install [Windows Subsystem for Linux][1] (WSL). Then, type.
wsl touch
or
wsl touch textfilenametoedit.txt
Quotes are not needed.
[1]:
[To see links please register here]