使用特定文件夹中的批处理文件创建txt文件 [英] Create a txt file using batch file in a specific folder

查看:108
本文介绍了使用特定文件夹中的批处理文件创建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"

这篇关于使用特定文件夹中的批处理文件创建txt文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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