'How to use the "touch" command to create a .py file? [duplicate]

When I try using the touch command I get an error saying:'touch' is not recognized as an internal or external command, operable program or batch file.

cmd


Solution 1:[1]

The touch command in only available on Unix based OS.

However, you can do the same on Windows by running:

type nul > your_file.py

Solution 2:[2]

dont't use touch command for windows

use echo command with redirect operation use > to overwrite and >> to append

c:\Windows\path>echo "" > file.py

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Rhylionn
Solution 2 Udesh Ranjan