vbs与bat脚本实现本地jdk版本自动切换

 

vbs脚本:

Dim fso
Set fso = CreateObject("Scripting.FileSystemObject")
fso.DeleteFile "C:\Program Files (x86)\Common Files\Oracle\Java\javapath\java.exe",true
fso.DeleteFile "C:\Program Files (x86)\Common Files\Oracle\Java\javapath\javaw.exe",true
fso.DeleteFile "C:\Program Files (x86)\Common Files\Oracle\Java\javapath\javaws.exe",true
fso.CopyFile "C:\Program Files (x86)\Common Files\Oracle\Java\javapath\jdk8-64\*","C:\Program Files (x86)\Common Files\Oracle\Java\javapath\",true
 

Set WshShell = WScript.CreateObject("WScript.Shell")
wshshell.run "java-version.bat",1,true

 

 

bat脚本

java -version
timeout /nobreak /t 4

 

posted @ 2021-05-19 16:32  这个名字想了很久~  阅读(108)  评论(0编辑  收藏  举报