Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Development Tools GitHub Basics Working By Yourself Create a Branch

touch command not recognized

I am trying to walk through this "Create a Branch" video, but running the commands against our github, not using the workspace. Everything is working up to the point of the "touch README.md" command which evokes " 'touch' is not recognized as an internal or external command, operable program or batch file." I am using Windows 7.

Is there an alternate command for Windows OS users or do we need to use some file editor to mimic the step?

3 Answers

My favorite method to create a new empty file in Windows without having to use an editor is...

copy con README.md

First enter the above command and press enter. Next, you can optionally enter text and/or just press CTRL + Z to finish. It will then tell you that your new file was copied (aka created). Quick and easy. ^_^

P.S. - The con keyword means copy contents from the console. A neat feature indeed.

Christian van Lierop
Christian van Lierop
13,758 Points

I have the exact same issue working from Visual Studio Code:

touch README.md touch : The term 'touch' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again. At line:1 char:1

  • touch README.md
  • ~~~~~
    • CategoryInfo : ObjectNotFound: (touch:String) [], CommandNotFoundException
    • FullyQualifiedErrorId : CommandNotFoundException

@Daniel Gagan : your fix doesn't seem to work for me either

copy con README.md copy : Cannot find path 'H:\Webdesign\100 Javascript projects\TestEnMeet\con' because it does not exist. At line:1 char:1

  • copy con README.md
  • ~~~~~~~~~~~~~~~~~~
    • CategoryInfo : ObjectNotFound: (H:\Webdesign\10...\TestEnMeet\con:String) [Copy-Item], ItemNotFoundException
    • FullyQualifiedErrorId : PathNotFound,Microsoft.PowerShell.Commands.CopyItemCommand

Not able to continue and understand the branching from this point on :-(

Jamie Reardon
seal-mask
.a{fill-rule:evenodd;}techdegree seal-36
Jamie Reardon
Treehouse Project Reviewer

The touch command is not a native command to Windows, its for UNIX/Linux e.g. MacOS. An equivalent to Windows would be what has been suggested in other comments, as well as echo and type. Having said that, you can still get access to this command through using a different console/terminal in Windows e.g. Git Bash.

See https://stackoverflow.com/questions/55584514/is-there-a-windows-equivalent-to-touch-to-create-a-new-file-in-cmd and https://stackoverflow.com/questions/1702762/how-can-i-create-an-empty-file-at-the-command-line-in-windows.