中国DOS联盟论坛

China DOS Union

-- Unite DOS · Advance DOS · Grow DOS --
Union site: www.cn-dos.net Forum site: www.cn-dos.net/forum
Guest | Log in | Register | Members | Search | China DOS Union
中国DOS联盟论坛
The time now is 2026-09-23 23:54
47,812 topics / 349,917 posts / today 0 new / 48,274 members
DOS批处理 & 脚本技术(批处理室) » Seeking help with the issue of if exit
Printable Version  1,903 / 7
Floor1 junyee Posted 2006-10-12 11:37
中级用户 Posts 112 Credits 253
Format: if exist file name  command to be executed
If the specified file exists, the condition is true, and the command is run; otherwise, the next sentence is run

If there are two or more commands to be executed, how should they be written?

Another question:
Find a segment of statements to have the following effect.
If 01.txt and 02.txt exist simultaneously under D:\
Then open the contents of 01.txt and 02.txt
Otherwise, delete 01.txt (or 02.txt) when only 01.txt or 02.txt exists

Looking forward to an answer~~~
Floor2 3742668 Posted 2006-10-12 11:53
荣誉版主 Posts 718 Credits 2,013
1.
2.

The code has not been tested...
Floor3 junyee Posted 2006-10-12 11:59
中级用户 Posts 112 Credits 253
Thanks. . .
Let's try first.
Floor4 namejm Posted 2006-10-12 12:22
荣誉版主 Posts 1,737 Credits 5,226 From 成都
Merge the code for 2F, which should meet the LZ's requirement:
Floor5 KIKOOOO Posted 2006-10-12 12:44
初级用户 Posts 12 Credits 34
What is the usage of || here? Is it a logical operation?
And what does the '''' in front of 1.txt mean?
Floor6 namejm Posted 2006-10-12 12:53
荣誉版主 Posts 1,737 Credits 5,226 From 成都
1、
  2、
When the filename is a path with spaces, you must enclose the path in quotes. At this time, in order to prevent start from treating the path as the title, insert a pair of quotes between start and the path to distinguish the title from the path.
Floor7 KIKOOOO Posted 2006-10-12 12:58
初级用户 Posts 12 Credits 34
Um, learning. Thanks
Floor8 NaturalJ0 Posted 2006-10-12 20:48
银牌会员 Posts 533 Credits 1,181


This format might be more convenient to use.
[ Contact the Union admin team - 中国DOS联盟 - Standard version ]
Sponsored by ifanr Inc | © 2001–2023