39

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 ?

ollieread
  • 5,591
  • 1
  • 17
  • 34
HussamDev
  • 389
  • 1
  • 3
  • 6

14 Answers14

119

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

GhostCat
  • 127,190
  • 21
  • 146
  • 218
cyberdenz
  • 1,291
  • 1
  • 8
  • 3
  • what if i don't use node. any default windows feature? – Sagar Nayak Apr 04 '18 at 01:49
  • 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
12

Fixed after running this command:

npm install touch-cli -g

After that I can run this:

touch .babelrc
Muhammad Awais
  • 3,310
  • 1
  • 34
  • 32
7

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

Community
  • 1
  • 1
ollieread
  • 5,591
  • 1
  • 17
  • 34
4

You can just use echo> in windows cmd i.epath/file.sqlite

Colleen Larsen
  • 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
4

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.

Andreas
  • 2,300
  • 10
  • 19
  • 23
Emmanuel David
  • 188
  • 2
  • 11
3

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
Jamaxack
  • 2,224
  • 2
  • 21
  • 35
3

You have to install Touch CLI, Run below command in CLI

npm install touch-cli -g
Rifkan Razak
  • 475
  • 1
  • 4
  • 15
2

enter image description here

ex: type nul >test.html in windows CMD & another one ways is

echo.>test.html

both are working 100% fine

YoungHobbit
  • 12,384
  • 9
  • 44
  • 70
seka
  • 101
  • 1
  • 5
  • 1
    The second alternative creates a 2 byte (crlf) file, it might be fine but not in all cases. – eckes Aug 17 '17 at 01:42
0

, used with copy to indicate missing parameters. This updates the files modified date. E.G. copy /b file1,,

0

Just run it through the GitBash terminal on windows and it works fine

thefett
  • 230
  • 2
  • 8
0

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.

0

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.

0

While Setup with Larvel mix in ExpressJs on windows touch webpack.mix.js touch is not recognized . Above methos helped me

type nul > (filename)
0

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.

Jarrett
  • 114
  • 1
  • 7