以下是一个示例的VBScript代码,可以用于批量修改指定文件夹中的文件后缀:

' 设置源文件夹路径和目标后缀
Dim sourceFolder, targetExtension
sourceFolder = "C:\SourceFolder"
targetExtension = ".new"

' 创建文件系统对象
Dim fso
Set fso = CreateObject("Scripting.FileSystemObject")

' 获取源文件夹对象
Dim folder
Set folder = fso.GetFolder(sourceFolder)

' 遍历源文件夹中的文件
Dim file
For Each file In folder.Files
    ' 修改文件后缀
    Dim fileName, newFileName
    fileName = fso.GetBaseName(file.Path)
    newFileName = fso.BuildPath(file.ParentFolder.Path, fileName & targetExtension)
    fso.MoveFile file.Path, newFileName
Next

' 释放资源
Set file = Nothing
Set folder = Nothing
Set fso = Nothing

请将代码中的sourceFolder变量修改为要处理的源文件夹的路径,targetExtension变量修改为目标后缀名。

此代码将遍历源文件夹中的所有文件,并将其后缀修改为目标后缀。例如,如果目标后缀为.new,则文件example.txt将被重命名为example.new

vbs代码批量修改文件后缀

原文地址: http://www.cveoy.top/t/topic/h9Gc 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录