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 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 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

--- or even if you don't want make it hard you can Just install Windows Subsystem for Linux (WSL). Then, type.

wsl touch

or

wsl touch textfilenametoedit.txt

Quotes are not needed.

Answer from Vlad Bezden on Stack Overflow
🌐
PhoenixNAP
phoenixnap.com › home › kb › sysadmin › how to use touch command in linux
How to Use touch Command in Linux (12 Examples)
December 19, 2025 - ... Events Let's Meet! ... The touch command's primary function is to modify a timestamp. Commonly, the utility is used for file creation, although this is not its primary function.
Discussions

What is the 'touch' command equivalent in Windows Terminal? - Stack Overflow
I'm trying to make a new folder in the directory I just created and in the tutorial video they told me to use 'touch example.js' but I get the error 'touch: The term "touch" is not recogn... More on stackoverflow.com
🌐 stackoverflow.com
Terminal touch -t - Apple Community
In Sierra I used the terminal touch -t command. It changed the modified date but not the created date. More on discussions.apple.com
🌐 discussions.apple.com
April 12, 2017
Terminal issue - metadata "touch" command… - Apple Community
Thanks Viking, for you input. Would you know of any scenarios where the touch command would work "randomly" (apart from typing errors, obviously) ... This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers. Terminal ... More on discussions.apple.com
🌐 discussions.apple.com
terminal - RTF files created using the 'touch' command will not open - Ask Different
I'm no expert on CLI or using the terminal or anything, but I like playing around with my computer. When I create a .txt .html or .md file or whatever using the 'touch' command in terminal, they w... More on apple.stackexchange.com
🌐 apple.stackexchange.com
🌐
iO Flood
ioflood.com › blog › touch-linux-command
Using the Touch Command in Linux | Reference Guide
December 19, 2023 - Another common use of the touch command is to update the timestamps of an existing file. Here’s an example: touch existingfile.txt ls -l existingfile.txt # Output: # -rw-r--r-- 1 user group 0 Jan 1 00:10 existingfile.txt · In this case, we used the touch command to update the timestamp of ‘existingfile.txt’. We can see from the output of the ls -l command that the timestamp has been updated to the current time.
🌐
LabEx
labex.io › questions › what-is-the-purpose-of-the-touch-command-in-linux-270254
What is Touch Command in Linux | LabEx
July 25, 2024 - Learn the purpose of the touch command in Linux for creating new files and updating timestamps efficiently.
🌐
GeeksforGeeks
geeksforgeeks.org › linux-unix › touch-command-in-linux-with-examples
Creating an Empty File in Linux | Touch Command - GeeksforGeeks
The touch command creates a new, empty file if the file does not already exist. If the file already exists, it updates the file’s last modified timestamp instead of overwriting it.
Published   December 8, 2025
🌐
IBM
ibm.com › docs › ssw_aix_72 › t_commands › touch.html
touch Command
We cannot provide a description for this page right now
Find elsewhere
🌐
Apple Community
discussions.apple.com › thread › 7920331
Terminal touch -t - Apple Community
April 12, 2017 - In Sierra I used the terminal touch -t command. It changed the modified date but not the created date.
🌐
LinuxBlog
linuxblog.io › home › touch command in linux /w examples
touch command in Linux /w examples
November 11, 2024 - The primary function of the touch command is to create empty files. Here’s how to create a single empty file: ... This command creates a file named my_file.txt in the current location.
🌐
TutorialsPoint
tutorialspoint.com › unix_commands › touch.htm
The touch command in Linux
... It ensures that only existing files are affected. To set the custom date and time, use the -d or --date option − ... The touch command in Linux is a versatile tool used to create empty files or update the access and modification timestamps of existing ones.
🌐
W3Schools
w3schools.com › bash › bash_touch.php
Bash touch Command - Change File Timestamps
The touch command is used to change file timestamps or create an empty file if it doesn't exist.
🌐
Apple Community
discussions.apple.com › thread › 251127580
Terminal issue - metadata "touch" command… - Apple Community
Hi - I have been trying to edit the creation date for a file in my movie library. I want to set the CREATION date to e.g. 4th of January 2020 10AM for a file. For this I use the command "touch -t 202001041000 /Users/[myaccountname]/Movies/filename.MP4".
🌐
How-To Geek
howtogeek.com › home › linux & macos terminal › how to use touch to create empty files and modify timestamps
How to Use Touch to Create Empty Files and Modify Timestamps
September 22, 2011 - In the above example touch will do nothing as “omar”, the file not the person, doesn’t exist. This option might come in handy if you want to copy a timestamp from a file to another file. Like so: ... Where “file1” is the reference file and “file2” is the file that will be updated. If you want to copy the timestamp to more than one file you can provide them all in the command as well and they will be created simultaneously.
🌐
LinuxHelp
linuxhelp.com › touch-command-in-linux-with-examples
Touch Command in Linux with Examples | LinuxHelp Tutorials
October 13, 2018 - Touch command is a standard program for Unix/Linux operating systems, used to create, change and modify timestamps of a file. -d is used to update the access and modification times -r is used to access and modification times of file -m is used ...
🌐
Linux Hint
linuxhint.com › create-new-file-using-touch-command-linux
How to Create a New File Using Linux Touch Command – Linux Hint
This is all about creating a new file using the touch command in Linux. The touch command contains different options to create and modify the files and directories from the terminal. We focused this guide solely on creating files using the touch command. Moreover, we used various examples to ...
🌐
GeeksforGeeks
geeksforgeeks.org › linux-unix › basic-linux-commands
25 Basic Linux Commands - GeeksforGeeks
2 weeks ago - The touch command creates an empty file named test.txt. The ln command in Linux is used to create links between files. Creates shortcuts to files. Supports hard and soft links. ... The ln command creates a symbolic link.
🌐
DigitalOcean
digitalocean.com › community › tutorials › linux-commands
50+ Essential Linux Commands: A Comprehensive Guide | DigitalOcean
April 8, 2025 - mkdir - Command used to create directories in Linux · mv - Move or rename files in Linux · cp - Similar usage as mv but for copying files in Linux · rm - Delete files or directories · touch - Create blank/empty files · ln - Create symbolic links (shortcuts) to other files · clear - Clear ...
🌐
Python
docs.python.org › 3 › library › os.html
os — Miscellaneous operating system interfaces
1 week ago - Grant access to the slave pseudo-terminal device associated with the master pseudo-terminal device to which the file descriptor fd refers. The file descriptor fd is not closed upon failure. Calls the C standard library function grantpt(). Availability: Unix, not WASI. Added in version 3.13. ... Return True if the file descriptor fd is open and connected to a tty(-like) device, else False. ... Apply, test or remove a POSIX lock on an open file descriptor. fd is an open file descriptor. cmd specifies the command to use - one of F_LOCK, F_TLOCK, F_ULOCK or F_TEST.
🌐
Raspberry Pi
raspberrypi.com › documentation › computers › os.html
Raspberry Pi OS - Raspberry Pi Documentation
For example, to direct video output to the touchscreen, and audio output to the headphone jack, use the following combination of the commands above: ... $ cvlc --play-and-exit --fullscreen --drm-vout-display DSI-1 -A alsa --alsa-audio-device sysdefault:CARD=Headphones your_video.mp4 · If you have a raw H.264 stream, like those captured from a Raspberry Pi Camera Module, you can improve playback performance in VLC by wrapping the stream inside a container format such as MP4.