- Name the batch file EXDIR.BAT.
- Include your name as a remark in EXDIR.BAT.
- Include the creation date as a remark in EXDIR.BAT.
- Include the function of EXDIR.BAT as a remark in EXDIR.BAT- redirects the output of dir C:\ to a file named by the user.
- The filename provided by the user is the first argument.
- A valid switch for the command dir is the optional second argument.
- If the file named by the user already exists, EXDIR.BAT immediately generates an error message and then exits without executing dir.
- The error message generated by EXDIR.BAT must display, "filename already exists, aborting EXDIR."
下列问题的DOS命令
- 提问者网友:我的未来我做主
- 2021-04-13 19:55
- 五星知识达人网友:刀戟声无边
- 2021-04-13 21:10
自己尝试着写了一下,希望你满足你的要求
rem -----------------------------------------------------------------
rem Name: EXDIR.BAT
rem Create by Qingzhu
rem Date: 2009.12.07
rem Function: The batch file EXDIR.BAT redirects the output of
rem dir C:\ to a file named by the user.
rem -----------------------------------------------------------------
@echo off
for /l %%i in (1,1,2) do goto arg%%i
:arg1
if exist %1 echo %1 already exists, aborting EXDIR. && goto end
goto exdir
:arg2
if exist %1 echo %1 already exists, aborting EXDIR. && goto end
goto exdir
:exdir
dir c:\ >%1 %2
goto end
:end
- 1楼网友:过活
- 2021-04-13 22:58
下面是翻译
命名批处理文件EXDIR.BAT。 包括作为EXDIR.BAT话你的名字。 包括作为EXDIR.BAT话创建日期。 包括作为EXDIR.BAT会上作上述表示的EXDIR.BAT功能重定向dir的C输出:\由用户指定的文件。 由用户提供的文件名是第一个参数。 一个有效的命令dir开关是可选的第二个参数。 如果该用户已经存在,EXDIR.BAT立即生成错误消息,然后退出命名的文件不执行署长。 此错误信息的EXDIR.BAT生成必须显示,“文件名已存在,中止EXDIR。”
应该是你的批处理写错误了。
- 2楼网友:骨子里都是戏
- 2021-04-13 22:30
错误~终止~!
你的批处理有问题~!