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 ?
-
Why 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
-
@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
14 Answers
if you are using node.js just use npm to install it on Windows:
C:\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
Fixed after running this command:
npm install touch-cli -g
After that I can run this:
touch .babelrc
![](../../users/profiles/3901944.webp)
- 3,310
- 1
- 34
- 32
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 can just use echo>
in windows cmd
i.epath/file.sqlite
![](../../users/profiles/6345027.webp)
- 573
- 1
- 9
- 21
-
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.
![](../../users/profiles/4502035.webp)
- 2,300
- 10
- 19
- 23
![](../../users/profiles/10013245.webp)
- 188
- 2
- 11
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
![](../../users/profiles/2077676.webp)
- 2,224
- 2
- 21
- 35
You have to install Touch CLI, Run below command in CLI
npm install touch-cli -g
![](../../users/profiles/8106270.webp)
- 475
- 1
- 4
- 15
ex: type nul >test.html in windows CMD & another one ways is
echo.>test.html
both are working 100% fine
![](../../users/profiles/2254048.webp)
- 12,384
- 9
- 44
- 70
![](../../users/profiles/6291322.webp)
- 101
- 1
- 5
-
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
,
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.
![](../../users/profiles/6928544.webp)
- 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
-
1
-
While Setup with Larvel mix in ExpressJs on windows touch webpack.mix.js touch is not recognized . Above methos helped me
type nul > (filename)
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.
![](../../users/profiles/14631246.webp)
- 114
- 1
- 7