HussamDev
HussamDev

Reputation: 649

'touch' is not recognized as an internal or external command, operable program or batch file

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 ?

Upvotes: 65

Views: 287063

Answers (20)

Ahnaf
Ahnaf

Reputation: 1

This error occurs because PowerShell's execution policy is set to restrict the execution of scripts. You can change the execution policy to allow scripts to run.

To solve this ->

  1. Search for "PowerShell" in the start menu. Right-click on "Windows PowerShell" and select "Run as administrator".

  2. Set-ExecutionPolicy RemoteSigned -Scope CurrentUser or Set-ExecutionPolicy Bypass -Scope CurrentUser

  3. Confirm the change when prompted by typing Y and pressing Enter.

Once you have changed the execution policy, you can run commands like touch, yarn etc in the terminal:

Thanks me later

Upvotes: 0

navalega0109
navalega0109

Reputation: 392

with npm install touch-cli -g it works inside VS Code.

touch.png

Upvotes: 0

SophieTP
SophieTP

Reputation: 44

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.

Upvotes: 1

Fail'
Fail'

Reputation: 1

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

Upvotes: 0

Fuze Thien
Fuze Thien

Reputation: 70

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:

  1. File -> Preferences -> Setting ( Or Ctrl + , ).
  2. Now, looking the top right and choose the icon "Open Settings (JSON)".
  3. 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"
  1. Finally reopen the VSCode and open the git bash terminal in your VSCode.

Notice: Make sure you have already installed Git Bash. Good luck!

Upvotes: 1

cyberdenz
cyberdenz

Reputation: 2281

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

Upvotes: 218

sara shamsher
sara shamsher

Reputation: 11

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

Upvotes: 1

NimaDoustdar
NimaDoustdar

Reputation: 326

run this code in cmd then Finish:)))))))

npm install touch-cli -g

Upvotes: -1

Jarrett GXZ
Jarrett GXZ

Reputation: 608

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.

Upvotes: 1

Abass Abdul Wahab
Abass Abdul Wahab

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

Upvotes: 0

khn Rzk
khn Rzk

Reputation: 1282

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

npm install touch-cli -g

Upvotes: 9

ahartami
ahartami

Reputation: 19

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.

Upvotes: 0

Jamaxack
Jamaxack

Reputation: 2460

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

Upvotes: 4

Muhammad Awais
Muhammad Awais

Reputation: 4492

Fixed after running this command:

npm install touch-cli -g

After that I can run this:

touch .babelrc

Upvotes: 30

Emmanuel David
Emmanuel David

Reputation: 411

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.

Upvotes: 5

thefett
thefett

Reputation: 278

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

Upvotes: 1

seka
seka

Reputation: 131

enter image description here

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

echo.>test.html

both are working 100% fine

Upvotes: 2

Colleen Larsen
Colleen Larsen

Reputation: 733

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

Upvotes: 5

user6017774
user6017774

Reputation:

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

Upvotes: 1

ollieread
ollieread

Reputation: 6248

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

Upvotes: 12

Related Questions