文章

vbs&createfile

vbs&createfile

输入文件名

1
2
3
4
dim Name
name = InputBox("Enter the file name")
msgBox "You entered: " & name
createfiles(name)

create 函数实现

1
2
3
4
5
6
7
8
9
10
11
sub createfiles(file_name)
    dim base_path : base_path = "E:\\vbs\\excel\\"
    dim fso
    set fso = CreateObject("Scripting.FileSystemObject")
    dim path : path = base_path & file_name
    if not fso.FileExists(path) then
        dim file
        set file = fso.CreateTextFile(path, true)
        file.Close
    end if 
end sub
本文由作者按照 CC BY 4.0 进行授权