使用特定文件夹中的批处理文件创建txt文件

问题描述:

我正在尝试创建一个批处理文件,该文件将在特定文件夹中创建一个文本文件.我可以在桌面上创建文本文件,但需要在特定的文件路径中创建文件.

I am trying to create a batch file which will create a text file in a specific folder. I am able to create a text file on my desktop, but I need to create a file in a specific file path.

例如,在D:/Testing文件夹中,我想创建一个用户定义的文本文件.

For example in D:/Testing folder I wants to create a user defined text file.

@echo off

echo .>> dblank.txt

我正在使用上面的代码在桌面上创建.txt文件.

I am using the above code to create a .txt file on my desktop.

我知道这是一个简单的问题,但是我搜索了google,但没有找到任何对我有帮助的好的解决方案.

I know this is a simple question but I searched google and have not found any good solution that could helpful to me.

您差不多完成了.只是明确地说出在哪里创建文件

You have it almost done. Just explicitly say where to create the file

@echo off
  echo.>"d:\testing\dblank.txt"

这将创建一个包含空白行(CR + LF = 2个字节)的文件.

This creates a file containing a blank line (CR + LF = 2 bytes).

如果您希望文件为空(0字节)

If you want the file empty (0 bytes)

@echo off
  break>"d:\testing\dblank.txt"