I work with laravel 5 , when i type in windows cmd this command "touch storage\database.sqlite" this error message rise 'touch' is not recognized as an internal or external command, operable program or batch file. any hint to solve it ?
-
1Why do you think you need to run it? – CL. Mar 21 '16 at 08:47
-
`touch` is a *nix command, not a Windows one. Here are some solutions: http://superuser.com/questions/10426/windows-equivalent-of-the-linux-command-touch/764716 – Joel Hinz Mar 21 '16 at 08:47
-
@JoelHinz unix* – FindOutIslamNow Aug 28 '18 at 08:42
-
1@FindOutIslamNow No, I meant *nix. Please have a look e.g. here https://stackoverflow.com/questions/4715374/what-is-the-meaning-of-nix-and-what-is-its-relation-with-ruby – Joel Hinz Aug 28 '18 at 14:20
-
To create a file in windows cmd you can use `type nul>example.txt` – AMD Sep 17 '20 at 21:37
19 Answers
if you are using node.js just use npm to install it on Windows with this command:
npm install touch-cli -g
it will install the command line interface for touch, you can then use it the same as unix...
-
-
If you don't use node, then you don't need it. This is the answer to a specific question of using 'touch' which is a *nix feature. It is mostly used by developers for them to easily create blank files. Other workarounds are stated below. – cyberdenz Apr 06 '18 at 14:57
-
Works OK for single files, but not when there's a comma-seprated list, as in this command to create two files simultaneously: `touch webpack.config.ts, webpack.config.prod.ts` - when that's run, only one file is created, called `webpack.config.ts,` (i.e. with a comma at the end of the name). – OutstandingBill Oct 06 '22 at 01:34
Fixed after running this command:
npm install touch-cli -g
After that I can run this:
touch .babelrc

- 4,238
- 1
- 42
- 37
The command you're trying to run is a unix/linux based command so it won't work in Windows.
All it does is update the modified timestamps of a file.
There's another question on here that gives you an alternative for Windows: https://superuser.com/questions/10426/windows-equivalent-of-the-linux-command-touch/764716
You have to install Touch CLI, Run below command in CLI
npm install touch-cli -g

- 1,124
- 2
- 15
- 26
You can just use echo>
in windows cmd
i.epath/file.sqlite

- 693
- 3
- 12
- 24
-
This may or may not work as it does not generate a 0 byte file. I typically use `type NUL > path/file.sqlite` as mentioned here: https://stackoverflow.com/a/295214/13189 – eckes Aug 17 '17 at 01:38
If you are on windows device just install git bash and type the following command
touch test.html.
The above command will generate a zero kilobyte test.html
file for you in your specified directory.
It is applicable to any other type of file.

- 2,455
- 10
- 21
- 24

- 410
- 7
- 17
-
git bash is a part of Git for Windows. (https://git-scm.com/download/win or https://gitforwindows.org/) – Wolf May 10 '23 at 11:47
If you are trying to use TypeScript in ReactNative first run:
npm install touch-cli -g
and then you can use touch, example:
touch rn-cli.config.js

- 2,400
- 2
- 24
- 42
ex: type nul >test.html in windows CMD & another one ways is
echo.>test.html
both are working 100% fine

- 13,254
- 9
- 50
- 73

- 131
- 1
- 6
-
1The second alternative creates a 2 byte (crlf) file, it might be fine but not in all cases. – eckes Aug 17 '17 at 01:42
Incase anyone is trying to use the 'touch' command from windows to configure Typescript for a React Native app, or anything else. It works for me by running the 'touch' command either from git bash or by downloading the WSL and running it from there.

- 486
- 7
- 13
You can type the same cmd in git bash in the folder where you want your compose file.

- 11
- 1
-
1As it’s currently written, your answer is unclear. Please [edit] to add additional details that will help others understand how this addresses the question asked. You can find more information on how to write good answers [in the help center](/help/how-to-ask). – Community Sep 18 '21 at 09:08
I was reading a solution in the GitHub community and it's effective for me.
If you are using VSCode and you would like to do something like Linux you can use git bash and it works the same. You can add git bash into VSCode by the following:
- File -> Preferences -> Setting ( Or Ctrl + , ).
- Now, looking the top right and choose the icon "Open Settings (JSON)".
- Add this to the last of the Setting file:
"terminal.integrated.profiles.windows": {
"Git Bash": {
"path": "C:\\Program Files\\Git\\bin\\bash.exe"
},
},
"terminal.integrated.defaultProfile.windows": "Git Bash"
- Finally reopen the VSCode and open the git bash terminal in your VSCode.
Notice: Make sure you have already installed Git Bash. Good luck!

- 2,324
- 26
- 22
- 31

- 50
- 1
- 6
I'm using window subsystem for linux. wsl works just fine mixing Windows and Linux commands:
wsl touch test.py
FYI I've found it here.

- 4,555
- 31
- 31
- 45

- 44
- 2
,
used with copy to indicate missing parameters. This updates the files
modified date. E.G. copy /b file1,,
I use this syntax in cmd. So far it is working well without installing something.
type nul > (filename)
In my case, I used
type nul > index.js // for creating an empty Javascript file.

- 21
- 1
If all the solutions above still dont work for you. Try this:
If you already have Git installed, then you also have GIT BASH installed too... To solve this problem navigate to your project directory using the GIT BASH Terminal and try again using touch Procfile
. It should work perfectly.
-
Would you mind providing links to the download where Git Bash can be obtained and explaining why you suggest "Procfile" as the file to "touch"? – santamanno Jan 20 '21 at 22:00
-
You may be using PowerShell. The team helped me Add-Content
.
Link to the page
https://learn.microsoft.com/en-us/powershell/module/microsoft.powershell.management/add-content?view=powershell-7.2&viewFallbackFrom=powershell-7.1
Example: Add-Content -Path .\Test.txt
//Test.txt
- name of file

- 1
- 1
run this code in cmd then Finish:)))))))
npm install touch-cli -g

- 318
- 3
- 5
-
Thanks for the effort, but the answer looks like it's already covered by the existing answers – KyleMit Sep 28 '22 at 15:31