中国DOS联盟论坛

中国DOS联盟

-- 联合DOS 推动DOS 发展DOS --

联盟域名:www.cn-dos.net  论坛域名:www.cn-dos.net/forum
DOS,代表着自由开放与发展,我们努力起来,学习FreeDOS和Linux的自由开放与GNU精神,共同创造和发展美好的自由与GNU GPL世界吧!

游客:  注册 | 登录 | 命令行 | 会员 | 搜索 | 上传 | 帮助 »
中国DOS联盟论坛 » DOS批处理 & 脚本技术(批处理室) » (已结)Need helps in "Dos Batch File"
作者:
标题: (已结)Need helps in "Dos Batch File" 上一主题 | 下一主题
ngen
初级用户





积分 38
发帖 8
注册 2005-9-12
状态 离线
『楼 主』:  (已结)Need helps in "Dos Batch File"

Part A: Analysis & Research

Examine any Delphi application directories of your choice used in Programming 1, or refer to the copy area for directory examples.
Find out which files are necessary to be:
•        included in a distribution of simple Delphi applications (ie. without ActiveX, DLL or Databases support via Delphi’s BDE)
•        kept as source code so that Delphi 7.x can re-build the project.

Your task is to write a batch file that will delete (only) the Delphi files in the current directory which are not needed to run a Delphi application, or to rebuild the application from the source files. No other files should be deleted.

The batch file should be named DCLEANUP.BAT, and has one optional parameter “/S” (Safe mode).

After running DCLEANUP /S
The current directory should contain only:
•        The files necessary for the distribution of an application (i.e. the .exe , .dll file & any data files)
•        The files that would allow Delphi 7.x to re-build the project, including extra files whose extensions are : *.res, *.cfg and *.dof.
•        Any other non-Delphi files (e.g. .dat, gif, jpg, htm,…) that were there previously.

After running DCLEANUP
The current directory should contain:
•        The minimum collection of files that would allow Delphi 7.x to re-build the project (i.e. without extra files).
•        Any other non-Delphi files (e.g. .dat, gif, jpg, htm,…) that were there previously.

In both cases, all normal DOS output to the screen should be suppressed.

After running DCLEANUP /? only help information related to usage of the program should be displayed without any file deletion. If  DCLEANUP.BAT file is renamed, then help information would automatically display its correct file name.

[ Last edited by willsort on 2005-9-18 at 18:42 ]

2005-9-12 07:39
查看资料  发送邮件  发短消息 网志   编辑帖子  回复  引用回复
willsort
元老会员

Batchinger


积分 4432
发帖 1512
注册 2002-10-18
状态 离线
『第 2 楼』:  

Re ngen:

      没有 Delph 的使用经验,无法确知哪些文件应该删除,而哪些应该保留?而这些文件的信息又可以从哪些途径可以找到?

      如果你能提供更详细的信息,也许我可以写一个相关的批处理程序。



※ Batchinger 致 Bat Fans:请访问 [讨论]批处理编程的异类 ,欢迎交流与共享批处理编程心得!
2005-9-12 16:49
查看资料  发送邮件  发短消息 网志   编辑帖子  回复  引用回复
ngen
初级用户





积分 38
发帖 8
注册 2005-9-12
状态 离线
『第 3 楼』:  

How to create a programn that delete specific files such *.exe or *sys... etc?

2005-9-13 04:35
查看资料  发送邮件  发短消息 网志   编辑帖子  回复  引用回复
willsort
元老会员

Batchinger


积分 4432
发帖 1512
注册 2002-10-18
状态 离线
『第 4 楼』:  

Re ngen:

      如果只是删除某几类扩展名相同的文件,那么问题要简单一些:
  @echo off
  for %%f in (*.exe *.sys) do del %%f
但是根据你在主楼的要求,似乎这样的处理未免简单了些。



※ Batchinger 致 Bat Fans:请访问 [讨论]批处理编程的异类 ,欢迎交流与共享批处理编程心得!
2005-9-13 08:48
查看资料  发送邮件  发短消息 网志   编辑帖子  回复  引用回复
ngen
初级用户





积分 38
发帖 8
注册 2005-9-12
状态 离线
『第 5 楼』:  

What about this, does it sounds good:
"
IF '%1' == '/?' GOTO Help
IF '%1' == '/s' GOTO s

:Start
del files *.~ddp, *.~dfm, *.~pas, *.dcu, *.dof, *.cfg, *.res, *.ddp, *.dll, *.exe
GOTO End

:Help
echo delete the following files from the Delphi application
GOTO End


:s
del files *.~ddp, *.~dfm, *.~pas, *.dcu
GOTO End



:End
pause
"

2005-9-13 10:56
查看资料  发送邮件  发短消息 网志   编辑帖子  回复  引用回复
willsort
元老会员

Batchinger


积分 4432
发帖 1512
注册 2002-10-18
状态 离线
『第 6 楼』:  

Re ngen:

      那么试试下面的代码吧:
:: DelphDel.bat - Delete files from the Delphi application
:: Will Sort - 2005/09/13 - CMD@WinXP
@echo off
IF "%1"=="" GOTO Start
IF "%1"=="/s" GOTO SafeMode
IF "%1"=="/S" GOTO SafeMode

:Help
echo Delete the following files from the Delphi application
for %%f in (*.~ddp, *.~dfm, *.~pas, *.dcu, *.dof, *.cfg, *.res, *.ddp, *.dll, *.exe) do echo %%f
GOTO End

:Start
for %%f in (*.~ddp, *.~dfm, *.~pas, *.dcu, *.dof, *.cfg, *.res, *.ddp, *.dll, *.exe) do del %%f
GOTO End

:SafeMode
for %%f in (*.~ddp, *.~dfm, *.~pas, *.dcu) do del %%f
GOTO End

:End
pause




※ Batchinger 致 Bat Fans:请访问 [讨论]批处理编程的异类 ,欢迎交流与共享批处理编程心得!
2005-9-13 15:12
查看资料  发送邮件  发短消息 网志   编辑帖子  回复  引用回复

请注意:您目前尚未注册或登录,请您注册登录以使用论坛的各项功能,例如发表和回复帖子等。


可打印版本 | 推荐给朋友 | 订阅主题 | 收藏主题



论坛跳转: