![]() |
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-08-13 06:19 |
47,811 topics / 349,897 posts / today 0 new / 48,256 members |
| DOS学习入门 & 精彩文章 (教学室) » Search for all executable files under the specified disk colon character |
| Printable Version 6,339 / 41 |
| Floor31 Thewindeagle | Posted 2006-11-02 12:13 |
| 新手上路 Posts 9 Credits 18 From 湖南 | |
|
Can someone explain that batch script? Thanks.
|
|
| Floor32 lxmxn | Posted 2006-11-03 02:00 |
| 版主 Posts 4,938 Credits 11,386 | |
|
The code above is as follows: Because this batch script deletes all executable files under the specified drive letter, the batch script first asks if you want to continue. If you choose y, the batch script jumps to the ":yes" label to execute the statements below the ":yes" label. If you choose n, the batch script directly jumps to the end of the file and exits directly. Then the batch script asks you to enter the drive letter to search. For example, entering a "D" assigns "D" to variable a to execute the following statements. This batch script uses the for + dir command. for is used to perform loop operations, that is, to execute the del command in a loop. The dir plus the "/b/s/a-d" parameter can enumerate all executable files under the specified drive letter. Each file enumerated is assigned to variable %%i, and then del %%i deletes it. |
|
| Floor33 vkill | Posted 2006-11-03 07:11 |
| 金牌会员 Posts 1,744 Credits 4,103 From 甘肃.临泽 | |
|
If I remember correctly, a lot was discussed before
|
|
| Floor34 Bee | Posted 2006-11-07 01:54 |
| 初级用户 Posts 16 Credits 44 From 广东省 | |
|
Then, if I change deletion to copying, how should I write it?
|
|
| Floor35 不得不爱 | Posted 2006-11-07 05:49 |
| 超级版主 Posts 2,044 Credits 5,310 From 四川南充 | |
|
Just change DEL to COPY.
——————————————————Moderation Record—————————————————— Performed by: Must Love Explanation: Multiple posting, {there are identical topics in DOS Batch & Script Technology (Batch Room), DOS Troubleshooting & Question Discussion (Help Room), DOS Learning Introduction & Exciting Articles (Teaching Room)} Action: Merge 3 identical topics and delete the original poster's duplicate posts ———————————————————————————————————————— [ Last edited by Must Love on 2006-11-6 at 05:51 PM ] |
|
| Floor36 Bee | Posted 2006-11-07 08:32 |
| 初级用户 Posts 16 Credits 44 From 广东省 | |
|
I have made changes. If I use the one given on the 5th floor and change DEL to COPY, for example, I want to copy to the 123 file under F:, then how should I write it? Please the moderator explain it to me carefully, okay?
|
|
| Floor37 lxmxn | Posted 2006-11-07 10:33 |
| 版主 Posts 4,938 Credits 11,386 | |
|
|
|
| Floor38 不得不爱 | Posted 2006-11-07 10:39 |
| 超级版主 Posts 2,044 Credits 5,310 From 四川南充 | |
|
@echo off
set /p a=Please enter the drive letter to search: for /f "tokens=*" %%i in ('dir /s/b/a-d C:\*.TXT') do copy “%%i” F:\123 echo The specified file has been copied to the F:\123 directory. pause |
|
| Floor39 Bee | Posted 2006-11-08 10:54 |
| 初级用户 Posts 16 Credits 44 From 广东省 | |
|
Thank you so much, everyone.. I can do it now
|
|
| Floor40 chainliq | Posted 2006-11-08 12:05 |
| 高级用户 Posts 244 Credits 635 From 广西贵港 | |
|
Haha, I'm quite experienced in killing this virus oh
del D:\**.logo1_.exe /s /a /f /q del c:\**.logo1_.exe /s /a /f /q Change a few more disks by yourself, also I uploaded a JS script before to kill it, definitely thorough oh! 1 Go find it! |
|
| Floor41 tclgb | Posted 2007-07-11 10:06 |
| 初级用户 Posts 26 Credits 76 | |
|
It's quite useful, but unfortunately it doesn't support Chinese paths.
Everyone can give it a try. If you just want to search for all executable files under a specified drive letter, you can use the following code: [ Last edited by tclgb on 2007-7-11 at 10:41 AM ] Attachments locate.zip (87.19 KiB) |
|
| Floor42 1112yuhua | Posted 2007-07-29 11:39 |
| 初级用户 Posts 44 Credits 106 | |
|
Thanks to the brother above for the reminder, it turns out that Chinese paths are not supported.
|
|
| Prev 1 2 3 |
|
[ Contact the Union admin team -
中国DOS联盟 -
Standard version ] Sponsored by ifanr Inc | © 2001–2023 |