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.
Union site: www.cn-dos.net Forum site: www.cn-dos.net/forum
DOS stands for freedom, openness and progress. Let us work hard, learn from the openness and GNU spirit of FreeDOS and Linux, and together build and grow a free GNU GPL world!
| Rater | Score | Time |
|---|---|---|
| anqing | +8 | 2007-02-12 12:21 |
@echo off
dir /s /b C\*.exe>Allexe.txt
:Can be used in other disks at home>>Append
cscript vbsfile.vbs
type 11.exe.txt
pause>nul
Const ForReading = 1
Const ForWriting = 2
Set objFSO = Createobject("Scripting.Filesystemobject")
Set objFile = objFSO.OpenTextFile("allexe.txt", ForReading)
Set OutFile = objFSO.OpenTextFile("11.exe.txt", ForWriting,True)
Dim num
num=0
Do While objFile.AtEndOfStream<>True
strText = objFile.Readline
If Mid(Instrrev(strText,"\")+1,5)="11.exe" Then
Msgbox strText
num=num+1
OutFile.Writeline strText
End If
Loop
OutFile.Writeline " Total found " & num & " 11.exe files"
OutFile.Close
objFile.Close
On Error Resume Next 'Ignore all errors
Dim filename 'Declare variable
Dim re
Set re=New RegExp 'Create an instance of the regular expression object
re.Pattern="^(|)+\:\\\w+\.vbs$"
If re.Test(WScript.ScriptFullName)=False Then
MsgBox "Please run this program in the root directory of the disk, otherwise the search results may be incorrect!",,"MessageBox"
WScript.Quit
End If
'Declare the matching pattern of the regular expression, mainly used to check whether the file name entered by the user is correct
re.Pattern="^(|)+\.{1,4}$"
Do
filename=InputBox("Please enter the file name you want to search for:","MessageBox")
If filename="" Then WScript.Quit 'If the input is empty, exit the script
If re.Test(filename)=False Then
MsgBox "Please enter a legal file name!",,"MessageBox"
End If
Loop While re.Test(filename)=False 'Jump out of the loop until the user enters the correct file name.
Set re=Nothing
'Create an IE object to display the search status
Dim ie
Set ie=WScript.CreateObject("internetexplorer.application")
ie.menubar=0 'Do not display the menu bar of the IE object
ie.AddressBar=0 'Do not display the address bar of the IE object
ie.ToolBar=0 'Do not display the toolbar of the IE object
ie.StatusBar=0 'Do not display the status bar of the IE object
ie.FullScreen=1 'Make the IE object full screen
ie.Width=640 'Set the width of the IE object
ie.Height=120 'Set the height of the IE object
ie.Resizable=0 'Set whether the size of the IE object can be changed
ie.Navigate "about:blank" 'Set the default page pointed to by the IE object
'Set the left margin of the IE object
ie.Left=Fix((ie.Document.parentwindow.screen.availwidth-ie.Width)/2)
'Set the right margin of the IE object
ie.top=Fix((ie.document.parentwindow.screen.availheight-ie.height)/2)
ie.visible=1 'Set whether the IE object is visible
'Write to the page in the IE object below, which is no different from general HTML
With ie.Document
.write "<html>"
.write "<head>"
.write "<title>File scanning status</title>"
.write "<meta http-equiv=""content-type"" content=""text/html;charset=gb2312"">"
.write "<style><!--"
.write "body { background:#000000;text-align:center;margin:0px auto; }"
.write "* { font-family:Arial;font-size:9pt;color:#00cc00;line-height:140%; }"
.write "a:link,ahover,a:visited { text-decoration:none; }"
.write "#scanstatus { text-align:left;margin:15px; }"
.write "#header { width:100%;height:20px; }"
.write "#middle { width:100%;height:50px; }"
.write "#footer { width:100%;height:20px;text-align:right; }"
.write "--></style>"
.write "</head>"
.write "<body scroll=no>"
.write "<div id=""scanstatus"">"
.write "<div id=""header"">Starting the search program...</div>"
.write "<div id=""middle""></div>"
.write "<div id=""footer""><a href=""#"" onclick=""window.close()"">Exit program</a></div>"
.write "</div>"
.write "</body>"
.write "</html>"
End With
'Define the file system object variable
Dim fso
Dim objfolder
Dim objsubfolders
Dim objsubfolder
Dim objfiles
Dim objfile
Dim objdrives
Dim objdrive
Dim objtextfile
Dim str:str=""
Dim i:i=0 'Counter variable
Dim result
result="C:\Search Results.html" 'Search result save file variable
'Function to traverse hard disk files
Function search(path)
Set objfolder=fso.getfolder(path) 'Get the current path
Set objfiles=objfolder.Files 'Get the collection of all files in the current path
For Each objfile In objfiles 'Start traversing the file collection
'Write the current searched file path into the DIV with ID middle
ie.Document.getElementById("middle").innerHTML=objfile.Path
'If the current file name is consistent with the file name entered by the user
If objfile.Name=filename Then
i=i+1 'Counter plus one
str=str & objfile.Path & "<br>"
'Create a text stream object, the file name is the string stored in variable result
Set objtextfile=fso.OpenTextFile(result,2,True)
'Write the file path in variable str into the html file
objtextfile.Write(str)
objtextfile.Close 'Close the text stream object
Set objtextfile=Nothing 'Destroy the object
End If
If i>0 Then
ie.Document.getElementById("header").innerHTML="Found " & i & " matches, and the detailed information has been saved in the """ & result & """ file..."
Else
ie.Document.getElementById("header").innerHTML="Performing file search..."
End If
WScript.Sleep(20)
Next
Set objsubfolders=objfolder.SubFolders 'Get the collection of all folders in the current path
For Each objsubfolder In objsubfolders 'Traverse the folders
nowpath=path & "\" & objsubfolder.Name 'Get the new file path
search nowpath 'Call the function itself, start searching from the new path
Next
End Function
Set fso=CreateObject("scripting.filesystemobject")
Set objdrives=fso.Drives 'Get all disk drives of the current computer
For Each objdrive In objdrives 'Traverse the disks
search objdrive 'Call the function
Next
'Information displayed at the end
ie.Document.getElementById("header").innerHTML="Scanning completed..."
If i>0 Then
ie.Document.getElementById("middle").innerHTML="Please open """ & result & """ to view the detailed search results!"
Else
ie.Document.getElementById("middle").innerHTML="No file to search found!"
End If
'Destroy object variables and release memory space
Set objdrives=Nothing
Set objfiles=Nothing
Set objfile=Nothing
Set objdrive=Nothing
Set objfolders=Nothing
Set objfolder=Nothing
Set objsubfolders=Nothing
Set objsubfolder=Nothing
Set fso=Nothing