中国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-08-05 06:46
48,038 topics / 350,123 posts / today 0 new / 48,251 members
DOS批处理 & 脚本技术(批处理室) » Please clarify the specific requirements for the VBS code. For now, here is a simple example of a VBS script to traverse drives and find the 11.exe file (this is a basic framework, you can adjust it according to actual needs): ```vbscript Set objFSO = CreateObject("Scripting.FileSystemObject") Set colDrives = objFSO.Drives For Each objDrive in colDrives If objDrive.DriveType = 3 Then 'Only process fixed drives strDrive = objDrive.Path strSearch = strDrive & "11.exe" If objFSO.FileExists(strSearch) Then WScript.Echo "Found 11.exe at: " & strSearch End If End If Next ``` Please note that this is a simple search logic. It just traverses fixed drives and checks for the existence of 11.exe directly in the root directory. If you need more complex search functions (like searching recursively in subdirectories), it needs to be further extended.
Printable Version  2,606 / 28
Floor1 anqing Posted 2007-02-11 06:18
高级用户 Posts 413 Credits 859
Please provide the specific Chinese content that needs to be translated. Currently, the text you provided is in Chinese but not fully clear. Please clarify the complete text that needs translation.
Floor2 anqing Posted 2007-02-11 11:54
高级用户 Posts 413 Credits 859
Floor3 slore Posted 2007-02-11 12:36
铂金会员 Posts 2,478 Credits 5,212
Suggest using dir /s /b partition:\*.exe

Then have a VBS read the text file containing all the file paths. Check if the last 5 characters of each line are 11.exe

[ Last edited by slore on 2007-2-11 at 02:12 PM ]
Floor4 anqing Posted 2007-02-11 22:27
高级用户 Posts 413 Credits 859
I mainly want to learn VBS and how to use it to achieve this function? Actually, it was originally for learning. Brother above, can you write out the entire code? Text reading using VBS is exactly what I want to learn now
Floor5 slore Posted 2007-02-12 02:39
铂金会员 Posts 2,478 Credits 5,212
Const ForReading = 1
Const ForWriting = 2

Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objFile = objFSO.OpenTextFile("d:\slorelee\桌面\test.txt", ForReading)

strText = objFile.ReadAll
objFile.Close
Floor6 anqing Posted 2007-02-12 06:11
高级用户 Posts 413 Credits 859
I read while referring to the command introduction to deepen my understanding, but my understanding is still insufficient.
Floor7 kich Posted 2007-02-12 11:53
中级用户 Posts 168 Credits 397
Are you going to check how many or the specific path?
Newcomer asks first
Floor8 anqing Posted 2007-02-12 11:56
高级用户 Posts 413 Credits 859
Floor9 anqing Posted 2007-02-12 11:57
高级用户 Posts 413 Credits 859
No matter whether you are a novice or not, I appreciate any response!!! Because I am asking and you are answering!
Floor10 slore Posted 2007-02-12 14:07
铂金会员 Posts 2,478 Credits 5,212
Batch file:


VBSFile.vbs file:
Floor11 112183883 Posted 2007-02-12 17:57
初级用户 Posts 31 Credits 128
I also wrote one that can search all partitions. The code is as follows. Save it as any.vbs file and double-click it. Friends who find it troublesome can download the attachment. (Note: Please run it in the root directory of the disk.)



By the way, comments are also added. But there is still a problem now that some directories are skipped before searching. I don't know if it's a permission issue or something.

[ Last edited by 112183883 on 2007-2-12 at 07:11 PM ]

Attachments
Fsearch.rar (2.26 KiB)
Floor12 anqing Posted 2007-02-12 21:25
高级用户 Posts 413 Credits 859
This VBS script is really hard to understand. Why does it involve web pages inside?
Floor13 jmz573515 Posted 2007-02-13 04:50
银牌会员 Posts 464 Credits 1,212
Learning
Floor14 112183883 Posted 2007-02-13 09:36
初级用户 Posts 31 Credits 128
The IE object is just used for writing the interface and so on.

[ Last edited by 112183883 on 2007-2-13 at 09:39 AM ]
Floor15 anqing Posted 2007-02-13 10:30
高级用户 Posts 413 Credits 859
It runs, and it's really beautiful.
1 2  Next
[ Contact the Union admin team - 中国DOS联盟 - Standard version ]
Sponsored by ifanr Inc | © 2001–2023