【发布时间】:2020-07-11 07:16:18
【问题描述】:
事实上,我是编程新手。所以如果你能帮助我,我会很高兴。 我需要在“if exits”命令中选择两件事,即两个文件或其中之一,以下命令适用。 这是代码:
if exist *.mp3 *.wma *.wav goto music
if exist *.mp4 *.mov goto video
if exist *.docx *.txt *.pdf goto document
if exist *.jpg *.png goto image
goto end
:music
md Music
move *.mp3 Music
move *.wma Music
move *.wav Music
if exist *.mp4 *.mov goto video
if exist *.docx *.txt *.pdf goto document
if exist *.jpg *.png goto image
goto end
:video
md Video
move *.mp4 Video
move *.mov Video
if exist *.docx *.txt *.pdf goto document
if exist *.jpg *.png goto image
goto end
:document
md Documents
move *.docx Documents
move *.txt Documents
move *.pdf Documents
if exist *.jpg *.png goto image
goto end
:image
md Pictures
move *.jpg Pictures
move *.png Pictures
goto end
:end
exit
我找了也没找到,试了各种办法都没有成功。 谢谢!
【问题讨论】:
-
如果存在不是你想要的命令。打开CMD,输入
For /?。
标签: batch-file if-statement file-exists