简体   繁体   English

VBScript通配符等效于T-SQL“%”

[英]VBScript Wildcard equivalent to T-SQL “%”

I'm trying to basically to see if a file exists that has the current date in its filename. 我试图从根本上看是否存在文件名中包含当前日期的文件。 In T-SQL when I want to search for something within a string, I just enclose it in "%" characters like this: %June 14 2012% 在T-SQL中,当我想在字符串中搜索某些内容时,只将其括在“%”字符中,如下所示:%June 14 2012%

How do I do something like that in VBScript? 如何在VBScript中执行类似的操作?

由于要查找文件,请使用“ *”。

Try something like: 尝试类似:

Folder = "C:\" 

Set fso = CreateObject("Scripting.FileSystemObject") 
Set fold = fso.GetFolder(folder) 
For Each file in fold.Files 
    If Instr(file, "June") >0 Then
        Response.Write file.name & " got it in filename!"
    End if 
Next 
Set fold = Nothing
Set fso = Nothing 

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM