源码
'批量修改文件后缀名
Function GetScriptPath()
GetScriptPath = Left(WScript.ScriptFullName, Len(WScript.ScriptFullName) - Len(WScript.ScriptName))
End Function
Dim before : before = InputBox("请输入要修改的文件后缀名:","用户输入") '获取用户输入的前缀
Dim suffix : suffix = InputBox("请输入修改后的文件后缀名:","用户输入") '获取用户输入的后缀
Dim getReturn
getReturn = MsgBox("确定要更改名称?", vbInformation + vbOKCancel, "警告提示")
if getReturn = vbOK then
'复制文件夹
set ws=wscript.createobject("wscript.shell")
Dim path :path = GetScriptPath()
ws.run"cmd " & path
'修改后缀
ws.run "cmd /c ren *." & before & " *." & suffix
dim word : word = "exit %s"
CreateObject("WScript.Shell").Run "taskkill /f /im cmd.exe", 0
end if
VBS关闭应用程序
- 格式:
CreateObject("WScript.Shell").Run "taskkill /f /im 文件名", 0
- 关闭cmd窗口:
CreateObject("WScript.Shell").Run "taskkill /f /im cmd.exe", 0