Windows等同于“触摸”(即创建index.html的node.js方法) [英] Windows equivalent of 'touch' (i.e. the node.js way to create an index.html)

查看:95
本文介绍了Windows等同于“触摸”(即创建index.html的node.js方法)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在Windows计算机上,我收到此错误


'touch'不被识别为内部或外部命令,可操作程序或批处理文件。


当我遵循说明

  touch index.html app.js style.css 

是否有等效于使用触摸的窗户?我是否需要手动创建这些文件(并修改它们以更改时间戳)才能实现这种命令?似乎不太... node-ish ...

解决方案

在cmd窗口中输入:

 类型nul> your_file.txt 

这将在your_file.txt文件中创建0个字节。



另一种方法是使用 echo 命令:

  echo。> your_file.txt 

echo。 -将在其中创建一个带有空行的文件。



于2019-04-01编辑:



如果需要保留文件内容,请使用>>而不是>

 >创建一个新文件
>>保留文件

示例



<$ p的内容$ p> type nul> your_file.txt

于2020-04-07编辑



您还可以使用呼叫


在不停止父批处理程序的情况下从另一个调用一个批处理程序。调用命令接受标签作为调用目标。


示例:

 呼叫>> your_file.txt 


On a windows machine I get this error

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

when I follow the instructions to do:

touch index.html app.js style.css

Is there a windows equivalent of using 'touch'? Do I need to create these files by hand (and modify them to change the timestamp) in order to implement this sort of command? That doesn't seem very ... node-ish...

解决方案

in cmd window type:

type nul > your_file.txt

This will create 0 bytes in your_file.txt file.

Another way of doing it is by using the echo command:

echo.> your_file.txt

echo. - will create a file with one empty line in it.

Edited on 2019-04-01:

If you need to preserve the content of the file use >> instead of >

>   Creates a new file
>>  Preserves content of the file

Example

type nul >> your_file.txt

Edited on 2020-04-07

You can also use call command.

Calls one batch program from another without stopping the parent batch program. The call command accepts labels as the target of the call.

Example:

call >> your_file.txt

这篇关于Windows等同于“触摸”(即创建index.html的node.js方法)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆