使用变量从批处理脚本创建文本文件

时间:2017-02-24 16:40:34

标签: windows batch-file

我正在尝试创建一个批处理文件,它将使用今天的日期为用户生成空白文本文件,并且用户输入的计数变量(例如:1,2,3等)将附加到日期的末尾,以便文件有不同的名称。这是我目前在我的批处理文件中所拥有的 -

@echo off
set /p id="Enter today's count: "
for /f "skip=1" %%x in ('wmic os get localdatetime') do if not defined MyDate set MyDate=%%x  
set today=%MyDate:~0,4%%MyDate:~4,2%%MyDate:~6,2%
set filename=%today%_%id%
utility>>"%filename%.txt"

虽然这会按照我想要的方式生成文件,但我得到以下内容 -

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

这是什么意思?这是我应该关注的事情,我该如何避免呢?

0 个答案:

没有答案
相关问题