專業(yè)的三維3D設(shè)計(jì)軟件-SolidWorks 2022sp5綠色版
[重要通告]如您遇疑難雜癥,本站支持知識(shí)付費(fèi)業(yè)務(wù),掃右邊二維碼加博主微信,可節(jié)省您寶貴時(shí)間哦!
SolidWorks的安裝特別麻煩,精簡(jiǎn)版的系統(tǒng)里居然裝不出來(lái),比如在有.NET4.8的環(huán)境下會(huì)出現(xiàn)安裝錯(cuò)誤等,所以制作了這個(gè)綠色版SolidWorks2022sp5綠色版;
SolidWorks是一款專業(yè)的三維3D設(shè)計(jì)軟件,功能強(qiáng)悍,支持分布式數(shù)據(jù)管理,支持直接處理網(wǎng)格數(shù)據(jù),提供更多的數(shù)據(jù)的靈活性,使用起來(lái)高效便捷??梢詭椭脩糨p松進(jìn)行3D CAD設(shè)計(jì)、機(jī)械設(shè)計(jì)、鈑金設(shè)計(jì)、模擬設(shè)計(jì)、電氣設(shè)計(jì)、PDM數(shù)據(jù)管理、CAM加工等。
安裝時(shí)除了主程序和語(yǔ)言,只選擇simulation和motion這兩個(gè)選項(xiàng),綠化前必須先安裝VC庫(kù)和.net4.8環(huán)境,但軟件自身要求了必須安裝net4.8環(huán)境,以免一些功能無(wú)法使用。
壓縮包解壓在任意位置,進(jìn)入文件夾,運(yùn)行最后一個(gè)VBS:雙擊靜默安裝.vbs,在I5 9400電腦上接近30秒完成綠化出現(xiàn)桌面圖標(biāo)。第一次進(jìn)系統(tǒng)時(shí)會(huì)有一個(gè)許可提示,再次進(jìn)入后不會(huì)再出現(xiàn)。
SolidWorks 2022sp5綠色版下載地址: https://www.123pan.com/s/p00rVv-1UqtH? 提取碼:6666
如需更改位置,可卸載重啟后移動(dòng)或更名文件夾重新再次運(yùn)行安裝程序。在火絨下安裝沒(méi)什么問(wèn)題,但如果是360還是建議關(guān)閉掉再安裝。
針對(duì)程序連網(wǎng)的情況,使用防火墻安全策略,把所有程序EXE可執(zhí)行程序都禁止連網(wǎng),能正常進(jìn)入,但不確定是否會(huì)影響一些功能,需要的自行把以下內(nèi)容復(fù)制粘貼到安裝的VBS中替換以前內(nèi)容:
Dim WshShell,objFSO,ver,ie,reg,windir,srv_dict,firewall_dict,objWMIService,Shell,obj(),objRegistry Set WshShell=WScript.CreateObject("WScript.Shell") Set objFSO = CreateObject("Scripting.FileSystemObject") Set objWMIService = GetObject("winmgmts:\\.") Set Shell=CreateObject("Shell.Application") Set srv_dict=CreateObject("Scripting.Dictionary") '需調(diào)整的服務(wù) Set firewall_dict=CreateObject("Scripting.Dictionary")'需禁止接連網(wǎng)絡(luò)的程序 Set objRegistry=GetObject("winmgmts:{impersonationLevel=impersonate}!\\.\root\default:StdRegProv") Set objWMI = GetObject("Winmgmts:\\.\Root\Cimv2") Set firewall_dict=CreateObject("Scripting.Dictionary") Set colOperatingSystems = objWMIService.InstancesOf("Win32_OperatingSystem") If WScript.Arguments.length = 0 Then Shell.ShellExecute "wscript.exe", Chr(34) & WScript.ScriptFullName & Chr(34) & " uac", "", "runas", 1 WScript.quit End If my_dir=left(wscript.scriptfullname,instrrev(wscript.scriptfullname,"")-1) '& "" '找到程序所在目錄 For Each objOperatingSystem In colOperatingSystems windir=objOperatingSystem.WindowsDirectory Next prog_dir=WshShell.ExpandEnvironmentStrings("%ProgramFiles%") prog86_dir=WshShell.ExpandEnvironmentStrings("%ProgramFiles(x86)%") user_dir=WshShell.ExpandEnvironmentStrings("%USERPROFILE%") pub_dir=WshShell.ExpandEnvironmentStrings("%PUBLIC%") data_dir=WshShell.ExpandEnvironmentStrings("%ProgramData%") Set tmp1 = objFSO.OpenTextFile(my_dir & "\setup.reg", 1) '讀入舊的文件 tmp2=tmp1.ReadAll:tmp1.close del my_dir & "\安裝修改.reg" if my_dir<>"D:\Program Files\SOLIDWORKS Corp" then tmp2=replace(tmp2,"D:\Program Files\SOLIDWORKS Corp\SOLIDWORKS",my_dir) bingpath=replace(my_dir,"","\") tmp2=replace(tmp2,"D:\\Program Files\\SOLIDWORKS Corp\\SOLIDWORKS",bingpath) bingpath=replace(my_dir,"","/") tmp2=replace(tmp2,"D:/Program Files/SOLIDWORKS Corp/SOLIDWORKS",bingpath) end if '"Toolbox Data Location"="d:\\Program Files\\SOLIDWORKS Corp\\SOLIDWORKS Data\" 'bingpath="""Toolbox Data Location""=""D:\\Program Files\\SOLIDWORKS Corp\\SOLIDWORKS Data""" 'tmp3="""Toolbox Data Location""=" & chr(34) & replace(my_dir,"","\") & chr(34) 'tmp2=replace(tmp2,bingpath,tmp3)'單獨(dú)替換ToolBox路徑 if windir<>"C:\\Windows" then tmp2=replace(tmp2,"C:\\Windows",replace(windir,"","\")) tmp2=replace(tmp2,"C:/Windows",replace(windir,"","/")) end if move_dir my_dir & "\Windows", windir bingpath=replace(prog_dir,"","\") if bingpath<>"C:\\Program Files" then tmp2=replace(tmp2,"C:\\Program Files",bingpath) tmp3=UCase(left(bingpath,2)) if tmp3<>"C:" then tmp2=replace(tmp2,"C:\\PROGRA",tmp3 & "\\PROGRA") end if move_dir my_dir & "\Program Files", prog_dir move_dir my_dir & "\Program Files (x86)", prog86_dir move_dir my_dir & "\AppData", user_dir if user_dir<>"C:\Users\AppData" then tmp2=replace(tmp2,"C:\\Users\\AppData",replace(user_dir,"","\")) end if bingpath=replace(pub_dir,"","\") if bingpath<>"C:\Users\Public" then tmp2=replace(tmp2,"C:\\Users\\Public",bingpath) end if bingpath=replace(data_dir,"","\") if bingpath<>"C:\\ProgramData" then tmp2=replace(tmp2,"C:\\ProgramData",bingpath) move_dir my_dir & "\ProgramData", bingpath'"C:\\ProgramData" Set tmp1=objFSO.OpenTextFile(my_dir & "\安裝修改.reg",8,True,0) tmp1.Write tmp2:tmp1.close:set tmp1=nothing ins= "regedit /s " & chr(34) & my_dir & "\安裝修改.reg" & chr(34) WshShell.Run ins,1,true ' 調(diào)入注冊(cè)表 '為保證成功,正在嘗試停止以前安裝錯(cuò)誤的服務(wù)... Close_Process("net.exe") '關(guān)閉程序 Close_Process("sc.exe") '關(guān)閉程序 '嘗試刪除之前裝錯(cuò)的服務(wù)... WshShell.Run "net.exe stop " & chr(34) & "SolidWorks Flexnet Server" & chr(34),0,true Wait("net.exe") WshShell.Run "sc.exe delete " & chr(34) & "SolidWorks Flexnet Server" & chr(34),0,true Wait("sc.exe") WshShell.Run "net.exe stop " & chr(34) & "WFlexNet Licensing Service 64" & chr(34),0,true Wait("net.exe") WshShell.Run "sc.exe delete " & chr(34) & "WFlexNet Licensing Service 64" & chr(34),0,true Wait("sc.exe") WshShell.Run "net.exe stop " & chr(34) & "SolidWorks Licensing Service" & chr(34),0,true Wait("net.exe") WshShell.Run "sc.exe delete " & chr(34) & "SolidWorks Licensing Service" & chr(34),0,true Wait("sc.exe") '重新安裝服務(wù) ins=my_dir & "\SolidWorks_Flexnet_Server" ins=chr(34) & ins & "installs.exe" & chr(34) & " -c " & chr(34) & ins & "sw_d_SSQ.lic" & chr(34) & " -e " & chr(34) & ins & "lmgrd.exe" & chr(34) & " -l " & chr(34) & ins & "sw_d_SSQ.log" & chr(34) & " -n " & chr(34) & "SolidWorks Flexnet Server" & chr(34) WshShell.Run ins,0,true '啟動(dòng)服務(wù) WshShell.Run "net.exe start " & chr(34) & "SolidWorks Flexnet Server" & chr(34),0,true '第2個(gè)服務(wù) bingpath=WshShell.ExpandEnvironmentStrings("%CommonProgramFiles(x86)%\SolidWorks Shared\Service\SolidWorksLicensing.exe") ins="sc create " & """SolidWorks Licensing Service"" binpath=" & chr(34) & bingpath & chr(34) & " start=auto displayname=""SolidWorks Licensing Service""" WshShell.Run ins,0,true ins="sc description " & """SolidWorks Licensing Service"" ""Provides authentication services for SolidWorks applications""" WshShell.Run ins,0,true WshShell.Run "net.exe start " & chr(34) & "SolidWorks Licensing Service" & chr(34),0,true '第3個(gè)服務(wù) bingpath=WshShell.ExpandEnvironmentStrings("%CommonProgramFiles%\Macrovision Shared\FlexNet Publisher\FNPLicensingService64.exe") ins="sc create " & """WFlexNet Licensing Service 64"" binpath=" & chr(34) & bingpath & chr(34) & " start=auto displayname=""WFlexNet Licensing Service 64""" WshShell.Run ins,0,true ins="sc description " & """WFlexNet Licensing Service 64"" ""This service performs licensing functions on behalf of FlexNet enabled products.""" WshShell.Run ins,0,true WshShell.Run "net.exe start " & chr(34) & "WFlexNet Licensing Service 64" & chr(34),0,true '改配置文件:sldIM_installed.xml WshShell.Run chr(34) & my_dir & "\sldProcMon.exe" & chr(34),1,true'初使化程序 'WshShell.Run chr(34) & my_dir & "\fontinst" & chr(34),0,true'安裝字體 Shortcut "SLDWORKS2022", my_dir & "\SLDWORKS.exe"'創(chuàng)建桌面圖標(biāo) bingpath=chr(34) & prog_dir & "\Common Files\SOLIDWORKS Shared" WshShell.Run "regsvr32.exe /s /u " & bingpath & "sldwinshellextu.dll" & chr(34),0,true WshShell.Run "regsvr32.exe /s /u " & bingpath & "sldthumbnailprovider.dll" & chr(34),0,true WshShell.Run "regsvr32.exe /s " & chr(34) & my_dir & "\swhtmlcontrol.dll" & chr(34),0,true del my_dir & "\安裝修改.reg" WshShell.Run "regsvr32.exe /s " & bingpath & "sldwinshellextu.dll" & chr(34),0,true WshShell.Run "regsvr32.exe /s " & bingpath & "sldthumbnailprovider.dll" & chr(34),0,true firewall_dict.add "SW2022_01",my_dir & "" & "DsgnChkRptView.exe" firewall_dict.add "SW2022_02",my_dir & "" & "gabiswengine.exe" firewall_dict.add "SW2022_03",my_dir & "" & "LocalSldService.exe" firewall_dict.add "SW2022_04",my_dir & "" & "mg-tetra.exe" firewall_dict.add "SW2022_05",my_dir & "" & "propertyManagerUpload.exe" firewall_dict.add "SW2022_06",my_dir & "" & "RTLibraryManager.exe" firewall_dict.add "SW2022_07",my_dir & "" & "SldBatchUploadPreprocessor.exe" firewall_dict.add "SW2022_08",my_dir & "" & "sldbgproc.exe" firewall_dict.add "SW2022_09",my_dir & "" & "sldCostingTemplateEditorAppU.exe" firewall_dict.add "SW2022_10",my_dir & "" & "SLDEXITAPP.exe" firewall_dict.add "SW2022_11",my_dir & "" & "sldphotoshopcon.exe" firewall_dict.add "SW2022_12",my_dir & "" & "sldProcMon.exe" firewall_dict.add "SW2022_13",my_dir & "" & "sldSettingsAdmin.exe" firewall_dict.add "SW2022_14",my_dir & "" & "SldToolboxConfigure.exe" firewall_dict.add "SW2022_15",my_dir & "" & "sldtoolboxupdater.exe" firewall_dict.add "SW2022_16",my_dir & "" & "SLDWORKS.exe" firewall_dict.add "SW2022_17",my_dir & "" & "sldworks_fs.exe" firewall_dict.add "SW2022_18",my_dir & "" & "swShellFileLauncher.exe" firewall_dict.add "SW2022_19",my_dir & "" & "swspmanager.exe" firewall_dict.add "SW2022_20",my_dir & "" & "testconsole.exe" firewall_dict.add "SW2022_21",my_dir & "" & "UtlReportViewer.exe" firewall_dict.add "SW2022_22",my_dir & "" & "x264.exe" firewall_dict.add "SW2022_23",my_dir & "" & "api\pidcollector.exe" firewall_dict.add "SW2022_24",my_dir & "" & "api\HTMLHelp2x\innovahxreg.exe" firewall_dict.add "SW2022_25",my_dir & "" & "cef\swCefSubProc.exe" firewall_dict.add "SW2022_26",my_dir & "" & "CircuitWorksFull\circuitworks.exe" firewall_dict.add "SW2022_27",my_dir & "" & "DriveWorksXpress\driveworksxpressdt.exe" firewall_dict.add "SW2022_28",my_dir & "" & "dsgnchk\Dsgnchkbldu.exe" firewall_dict.add "SW2022_29",my_dir & "" & "dsgnchk\DsgnChkDesignBinderu.exe" firewall_dict.add "SW2022_30",my_dir & "" & "FloXpress\bin\efdsolver.exe" firewall_dict.add "SW2022_31",my_dir & "" & "FloXpress\bin\ffmpeg.exe" firewall_dict.add "SW2022_32",my_dir & "" & "myproducts\myproducts.exe" firewall_dict.add "SW2022_33",my_dir & "" & "photoview\foundrycrashhandler.exe" firewall_dict.add "SW2022_34",my_dir & "" & "photoview\photoview360.exe" firewall_dict.add "SW2022_35",my_dir & "" & "photoview\photoview360_cl.exe" firewall_dict.add "SW2022_36",my_dir & "" & "photoview\QtWebEngineProcess.exe" firewall_dict.add "SW2022_37",prog_dir & "\Common Files\SOLIDWORKS Shared\sldShellExtServer.exe" firewall_dict.add "SW2022_38",prog_dir & "\Common Files\SOLIDWORKS Shared\2022\lmutil.exe" firewall_dict.add "SW2022_39",prog_dir & "\Common Files\SOLIDWORKS Shared\2022\swlmutil.exe" firewall_dict.add "SW2022_40",prog_dir & "\Common Files\SOLIDWORKS Shared\2022\swlmwiz.exe" firewall_dict.add "SW2022_41",prog_dir & "\Common Files\SOLIDWORKS Shared\2022\sldrx\sldrx.exe" firewall_dict.add "SW2022_42",prog_dir & "\Common Files\SOLIDWORKS Shared\2022\sldrx\sldrxET.exe" firewall_dict.add "SW2022_43",prog_dir & "\Common Files\SOLIDWORKS Shared\2022\sldrx\sldrxmm.exe" firewall_dict.add "SW2022_45",progx86_dir & "\Common Files\SOLIDWORKS Shared\Service\Service\SolidWorksLicensing.exe" firewall_dict.add "SW2022_46",progx86_dir & "\Common Files\SOLIDWORKS 安裝管理程序\30.0\sldimdownloader.exe" firewall_dict.add "SW2022_47",progx86_dir & "\Common Files\SOLIDWORKS 安裝管理程序\BackgroundDownloading\sldBgDwld.exe" firewall_dict.add "SW2022_48",progx86_dir & "\Common Files\SOLIDWORKS 安裝管理程序\CheckForUpdates\sldCheckForUpdates.exe" firewall_dict.add "SW2022_49",my_dir & "" & "setup\i386\copyoptwiz.exe" firewall_dict.add "SW2022_50",my_dir & "" & "setup\i386\swactwiz.exe" firewall_dict.add "SW2022_51",my_dir & "" & "setup\i386\swactwizhelpersc.exe" firewall_dict.add "SW2022_52",my_dir & "" & "setup\i386\swactwiz_s.exe" firewall_dict.add "SW2022_53",my_dir & "" & "setup\i386\swinstactsvc.exe" firewall_dict.add "SW2022_54",my_dir & "" & "setup\i386\swlicservinst.exe" firewall_dict.add "SW2022_55",my_dir & "" & "setup\i386\x86\swlicservinst.exe" firewall_dict.add "SW2022_56",my_dir & "" & "Simulation\check.exe" firewall_dict.add "SW2022_57",my_dir & "" & "Simulation\check_net.exe" firewall_dict.add "SW2022_58",my_dir & "" & "Simulation\cos2abq.exe" firewall_dict.add "SW2022_59",my_dir & "" & "Simulation\cos2ans.exe" firewall_dict.add "SW2022_60",my_dir & "" & "Simulation\cos2nas.exe" firewall_dict.add "SW2022_61",my_dir & "" & "Simulation\cos2pat.exe" firewall_dict.add "SW2022_62",my_dir & "" & "Simulation\cos2xds.exe" firewall_dict.add "SW2022_63",my_dir & "" & "Simulation\cwanalysisproc.exe" firewall_dict.add "SW2022_64",my_dir & "" & "Simulation\cwbcbfmesh.exe" firewall_dict.add "SW2022_65",my_dir & "" & "Simulation\cwmeshproc.exe" firewall_dict.add "SW2022_66",my_dir & "" & "Simulation\dpost.exe" firewall_dict.add "SW2022_67",my_dir & "" & "Simulation\dstar.exe" firewall_dict.add "SW2022_68",my_dir & "" & "Simulation\fat.exe" firewall_dict.add "SW2022_69",my_dir & "" & "Simulation\ghs3d.exe" firewall_dict.add "SW2022_70",my_dir & "" & "Simulation\ghs3dv3.exe" firewall_dict.add "SW2022_71",my_dir & "" & "Simulation\hstar.exe" firewall_dict.add "SW2022_72",my_dir & "" & "Simulation\ids2cos.exe" firewall_dict.add "SW2022_73",my_dir & "" & "Simulation\nstar.exe" firewall_dict.add "SW2022_74",my_dir & "" & "Simulation\pre1.exe" firewall_dict.add "SW2022_75",my_dir & "" & "Simulation\renum.exe" firewall_dict.add "SW2022_76",my_dir & "" & "Simulation\SOLIDWORKS Simulation Network Share.exe" firewall_dict.add "SW2022_77",my_dir & "" & "Simulation\star.exe" firewall_dict.add "SW2022_78",my_dir & "" & "Simulation\stopt.exe" firewall_dict.add "SW2022_79",my_dir & "" & "Simulation\stres.exe" firewall_dict.add "SW2022_80",my_dir & "" & "Simulation\sysinf.exe" firewall_dict.add "SW2022_81",my_dir & "" & "Simulation\License\setup\i386\swlicservinst.exe" firewall_dict.add "SW2022_82",my_dir & "" & "Simulation\setup\i386\swactwiz.exe" firewall_dict.add "SW2022_83",my_dir & "" & "Simulation\setup\i386\swlicservinst.exe" firewall_dict.add "SW2022_84",my_dir & "" & "Simulation\Topology\code\bin\smatoctoscaservermain.exe" firewall_dict.add "SW2022_85",my_dir & "" & "Simulation\Topology\code\bin\SMATrtOptResExportTool.exe" firewall_dict.add "SW2022_86",my_dir & "" & "Simulation\Topology\code\bin\SMATrtOptResImportTool.exe" firewall_dict.add "SW2022_87",my_dir & "" & "Simulation\Topology\code\bin\SMATrtOptResInfo.exe" firewall_dict.add "SW2022_88",my_dir & "" & "Simulation\Topology\code\bin\smatrttstructsmoothmain.exe" firewall_dict.add "SW2022_89",my_dir & "" & "Simulation\Topology\code\bin\smatsocosmosjobchecker.exe" firewall_dict.add "SW2022_90",my_dir & "" & "Simulation\Topology\code\bin\smatsocosmossetlc.exe" firewall_dict.add "SW2022_91",my_dir & "" & "Simulation\Topology\code\bin\smatsofeminclude.exe" firewall_dict.add "SW2022_92",my_dir & "" & "Simulation\Topology\code\bin\smatsofemmodif.exe" firewall_dict.add "SW2022_93",my_dir & "" & "Simulation\Topology\code\bin\smatsofemtoonf.exe" firewall_dict.add "SW2022_94",my_dir & "" & "Simulation\Topology\code\bin\smatsorestovtm.exe" firewall_dict.add "SW2022_95",my_dir & "" & "Simulation\Topology\code\bin\smatsotoscaopt.exe" firewall_dict.add "SW2022_96",my_dir & "" & "Simulation\Topology\code\bin\smatsotoscaprep.exe" firewall_dict.add "SW2022_97",my_dir & "" & "Simulation\Topology\code\bin\smatsotoscapython.exe" firewall_dict.add "SW2022_98",my_dir & "" & "Simulation\Topology\tools\smapy\python\python.exe" firewall_dict.add "SW2022_99",my_dir & "" & "Simulation\Topology\tools\smapy\python\pythonw.exe" firewall_dict.add "SW2022_100",my_dir & "" & "Simulation\Utilities\cosmossupporttool.exe" firewall_dict.add "SW2022_101",my_dir & "" & "Simulation\Utilities\material.exe" firewall_dict.add "SW2022_102",my_dir & "" & "Simulation\Utilities\simulation cleaning utility.exe" firewall_dict.add "SW2022_103",my_dir & "" & "sldBenchmarking\sldBenchmark.exe" firewall_dict.add "SW2022_104",my_dir & "" & "sldPropertyTabBuilder\PropertyTabBuilder.exe" firewall_dict.add "SW2022_105",my_dir & "" & "sldutils\GtReportManager.exe" firewall_dict.add "SW2022_106",my_dir & "" & "SolidWorks_Flexnet_Server\installs.exe" firewall_dict.add "SW2022_107",my_dir & "" & "SolidWorks_Flexnet_Server\lmgrd.exe" firewall_dict.add "SW2022_108",my_dir & "" & "SolidWorks_Flexnet_Server\lmtools.exe" firewall_dict.add "SW2022_109",my_dir & "" & "SolidWorks_Flexnet_Server\lmutil.exe" firewall_dict.add "SW2022_110",my_dir & "" & "SolidWorks_Flexnet_Server\sw_d.exe" firewall_dict.add "SW2022_111",my_dir & "" & "spiop\sldimport.exe" firewall_dict.add "SW2022_112",my_dir & "" & "spiop\files\code\bin\cnextmproc.exe" firewall_dict.add "SW2022_113",my_dir & "" & "spiop\files\code\bin\spaxchildconnect.exe" firewall_dict.add "SW2022_114",my_dir & "" & "spiop\files\code\bin\spaxchildprocess.exe" firewall_dict.add "SW2022_115",my_dir & "" & "spiop\files\code\bin\spaxchilduconnectacis.exe" firewall_dict.add "SW2022_116",my_dir & "" & "spiop\files\code\bin\spaxchilduconnectcgm.exe" firewall_dict.add "SW2022_117",my_dir & "" & "spiop\files\code\bin\spaxchilduconnectps.exe" firewall_dict.add "SW2022_118",my_dir & "" & "swScheduler\DTSCoordinatorService.exe" firewall_dict.add "SW2022_119",my_dir & "" & "swScheduler\DTSMonitor.exe" firewall_dict.add "SW2022_120",my_dir & "" & "swScheduler\DTSServiceManager.exe" firewall_dict.add "SW2022_121",my_dir & "" & "swScheduler\swboengine.exe" firewall_dict.add "SW2022_122",my_dir & "" & "swScheduler\swScheduler.exe" firewall_dict.add "SW2022_123",my_dir & "" & "swVBAServer\drawcompare.exe" firewall_dict.add "SW2022_124",my_dir & "" & "ThemeEditor\PresentationStudioThemeEditor.exe" firewall_dict.add "SW2022_125",my_dir & "" & "Toolbox\data utilities\DatabaseConverter.exe" firewall_dict.add "SW2022_126",my_dir & "" & "Toolbox\data utilities\sldsetdocprop.exe" firewall_dict.add "SW2022_127",my_dir & "" & "Toolbox\data utilities\UpdateBrowserDatabase.exe" firewall_dict.add "SW2022_128",my_dir & "" & "Treehouse\Treehouse.exe" firewall_dict.add "SW2022_129",windir & "" & "SolidWorks\IM_20220-40500-1100-100\setup.exe" firewall_dict.add "SW2022_130",windir & "" & "SolidWorks\IM_20220-40500-1100-100\sldim\sldadminoptioneditor.exe" firewall_dict.add "SW2022_131",windir & "" & "SolidWorks\IM_20220-40500-1100-100\sldim\sldIM.exe" For Each i in firewall_dict'禁止程序連網(wǎng) firewall_dict(i)=WshShell.ExpandEnvironmentStrings(firewall_dict(i)) 'netsh advfirewall firewall del rule name=i tmp1=" del rule name=" & chr(34) & i & chr(34) 'netsh advfirewall firewall add rule name=i program=i action=block dir=out tmp2=" add rule name=" & chr(34) & i & chr(34) & " program=" & chr(34) & firewall_dict(i) & chr(34) & " action=block dir=out" 'netsh advfirewall firewall add rule name=i service=%%j action=block dir=out program="%svchost_exe%" tmp3=" add rule name=" & chr(34) & i & chr(34) & " service=" & chr(34) & firewall_dict(i) & chr(34) & " action=block dir=out program=" & chr(34) & windir & "\system32\svchost.exe" & chr(34) WshShell.Run "netsh advfirewall firewall " & tmp1 ,0,true '刪除之前規(guī)則 WshShell.Run "netsh advfirewall firewall " & tmp2 ,0,true '建立新規(guī)則 if i="Windows Update" then WshShell.Run "netsh advfirewall firewall " & tmp3 ,0,true '添加阻止服務(wù)出站規(guī)則 next i=WshShell.popup("工作完成,確認(rèn)或無(wú)操作5秒后運(yùn)行SW2022,如不需要請(qǐng)及時(shí)取消",5,"SolidWorks安裝程序",VbOKCancel) if i=vbOK or i=-1 then WshShell.Run my_dir & "\SLDWORKS.exe",1,true Wscript.Quit Function move_dir(dir0,dir1)'dir0:原目錄;dir1:移動(dòng)過(guò)去的新目錄 dim file,fs,items,objdir dir1=UCase(trim(dir1)):if right(dir1,1)="" then dir1=left(dir1,len(dir1)-1) '容錯(cuò)去空格和后\ dir0=UCase(trim(dir0)):if right(dir0,1)="" then dir0=left(dir0,len(dir0)-1) '容錯(cuò)去空格和后\ fs = Split(dir1, "") for each file in fs if not file=nul then items=items&file&"" if not objFSO.FileExists(items&"\nul") then Set objdir = objFSO.CreateFolder(items) next objdir=left(dir1,instrrev(dir1,"")-1) '& "" fs=right(dir1,len(dir1)-len(objdir)) if fs=right(dir0,len(fs)) then dir1=objdir if right(dir1,1)=":" then dir1=dir1 & "" end if 'CreateObject("Shell.Application").NameSpace(dir1).MoveHere dir0,&H0&'FOF_CREATEPROGRESSDLG '上述方法不能直接覆蓋,所以只能用復(fù)制和刪除 on error resume next objFSO.CopyFolder dir0,dir1,True '復(fù)制目錄里的文件到新的地方 'del(dir0)'暫時(shí)不忙刪除,萬(wàn)一需要重復(fù)安裝? on error goto 0 End Function Function NetWork(val) '因未設(shè)置延遲,所以不要重復(fù)調(diào)用或在短時(shí)內(nèi)操作網(wǎng)絡(luò) '接收參數(shù):0:關(guān)閉“本地連接” 1:打開(kāi)“本地連接” 2:自動(dòng)(關(guān)閉則打開(kāi);打開(kāi)則關(guān)閉) dim w,i Set w=objWMI.ExecQuery("select * from WIN32_NetworkAdapter") For Each i In w If instr(i.NetConnectionID,"本地連接")>0 or instr(i.NetConnectionID,"以太網(wǎng)")>0 Then if val=0 then i.Disable if val=1 then i.Enable if val=2 then If i.NetConnectionStatus<>0 then i.Disable Else i.Enable end if end if End If next set w=nothing 'wscript.sleep 400 End Function Function Wait(proc) '等待程序完成,十秒還沒(méi)完成則退出 dim mark,obj,proce,data,x do mark=0 Set obj = getobject("winmgmts:\\.\root\cimv2") Set proce = obj.execquery("select * from win32_process") For each x in proce if lcase(x.name)=proc then mark=1 data=data+1 next if mark=0 or data>100 then exit do wscript.sleep 100 Set obj = nothing Set proce = nothing loop End Function '關(guān)閉程序 Function Close_Process(ProcessName) '關(guān)閉程序 Set objWMIService = GetObject("winmgmts:{impersonationLevel=impersonate}!\\.\root\cimv2") Set colProcessList = objWMIService.ExecQuery ("Select * from Win32_Process Where Name = '" & ProcessName & "'") For Each objProcess in colProcessList objProcess.Terminate() Next End Function Function Shortcut(Short_name,path_and_name) '為在桌面創(chuàng)建一個(gè)快捷方式 strDesktop = WshShell.SpecialFolders("AllUsersDesktop") '在桌面創(chuàng)建一個(gè)快捷方式 set oShellLink = WshShell.CreateShortcut(strDesktop & "" & Short_name & ".lnk") '名稱 oShellLink.TargetPath = path_and_name '目標(biāo) oShellLink.WindowStyle = 1 '窗口樣式 1默認(rèn)窗口激活,參數(shù)3最大化激活,參數(shù)7最小化 oShellLink.Hotkey = "" '快捷鍵 oShellLink.IconLocation = path_and_name & ",0" '第幾個(gè)圖標(biāo) oShellLink.Description = Short_name '備注 oShellLink.WorkingDirectory = left(path_and_name,InStrRev(path_and_name,"")-1) '起始位置 oShellLink.Arguments = "" '參數(shù) oShellLink.Save '保存 End Function Function del(del_file) '刪除文件或者文件夾,之所以最后一種可能實(shí)現(xiàn)前兩種功能還要分開(kāi)成三種,是因?yàn)樾? dim file_path,str2,str3,pattern,tmp1,tmp2,tmp3 tmp2="":tmp3="" '初使化臨時(shí)變量 del_file=WshShell.ExpandEnvironmentStrings(trim(del_file))'還原帶環(huán)境變量,去掉空格,下面這句設(shè)置解屬性參數(shù),其中SID在上文已定義 file_path = lcase(objFSO.GetParentFolderName(del_file)) '取父目錄方法 if del_file="" then del="調(diào)用時(shí)沒(méi)寫(xiě)被刪除的文件":exit Function if not objFSO.FolderExists(file_path) then del="沒(méi)找到父文件夾:" & del_file :exit Function on error resume next WshShell.Run "takeown.exe /f " & chr(34) & windir & del_file & chr(34),0,true WshShell.Run "icacls.exe /f " & chr(34) & windir & del_file & chr(34) & " /grant administrators:F",0,true objFSO.deletefile del_file,true '用通配符刪除文件 objFSO.deletefolder del_file,true '直接刪除文件夾 on error goto 0 End Function Function SRV_ADD(Service_Name,mode) 'Set tmp=GetObject("winmgmts:\\.\root\cimv2").get("win32_service") 'uu=tmp.create("WFlexNet Licensing Service 64","FlexNet Licensing Service 64","C:\Program Files\Common Files\Macrovision Shared\FlexNet 'Publisher\FNPLicensingService64.exe",16,2,"Manual",True,Null,null) 'Set tmp=nothing End Function '例:Call SRV("RemoteAccess","del") Function SRV(Service_Name,mode)'設(shè)置系統(tǒng)服務(wù),stop:停,Start:啟,del:刪,Disabled:禁,Automatic:自動(dòng),Manual:手動(dòng),delayed-auto延遲啟動(dòng) dim ObjServices,SRV_msg'返回值:正常完成/操作值錯(cuò)mode/無(wú)此服務(wù) Set ObjServices = GetObject("winmgmts:\\.\root\cimv2").ExecQuery("Select * from Win32_Service where Name="&"'"&Service_Name &"'") SRV="未找到" & Service_Name:FOREXIT=0 For Each Service In ObjServices SRV="有服務(wù)" & Service_Name Service_mode=LCase(mode)'默認(rèn)手工啟動(dòng),是否考慮預(yù)置Start=3 ? Select Case LCase(Service_mode) Case "stop"'停止服務(wù) Call Service.StopService() Start=0 'If Service.State = "Running" Then '不同服務(wù)停下來(lái)時(shí)間不一樣 Case "start"'啟動(dòng)服務(wù) Call Service.Start() Start=0 Case "del"'刪除服務(wù) Start=6 Case "demand"'手動(dòng) Start = 3 Case "auto"'自動(dòng)啟動(dòng) Start = 2 Service_mode="Automatic" Case "delayed-auto"'延遲啟動(dòng) Start = 5 Service_mode="Automatic" Case "disabled"'禁用 Start = 4 Service_mode="Disabled" case else SRV="操作錯(cuò)" & mode Start=0 End Select if Start>0 then Set oReg=GetObject("winmgmts:{impersonationLevel=impersonate}!\\.\root\default:StdRegProv") oReg.EnumKey HKEY_LOCAL_MACHINE,"SYSTEM\CurrentControlSet\Services",arrSubKeys SRV="無(wú)服務(wù)" & Service_Name For Each subkey In arrSubKeys SRV="找到有" & Service_Name if subkey=Service.Name then if Start=6 then '單獨(dú)處理刪除服務(wù) SRV_reg="HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services" & subkey & "\Start" Service.StopService() '防火墻服務(wù)必須停止后才能刪除,其他大多不必 Service.Delete():SRV="刪成功" & subkey'刪除本服務(wù) SRV_msg="":on error resume next:SRV_msg=WshShell.RegRead(SRV_reg):on error goto 0'嘗試讀這個(gè)服務(wù) if SRV_msg>"" then'如果這個(gè)服務(wù)仍然沒(méi)被刪除就解除注冊(cè)表權(quán)限然后嘗試直接刪除注冊(cè)表 SetRegACL "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services"& subkey oReg.deletekey HKEY_LOCAL_MACHINE ,"SYSTEM\CurrentControlSet\Services" & subkey SRV_msg="":on error resume next:SRV_msg=WshShell.RegRead(SRV_reg):on error goto 0'嘗試讀這個(gè)服務(wù) if SRV_msg>"" then '嘗試使用Reg命令 'msgbox "cmd /c reg delete ""HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services" & subkey & """ /f" WshShell.Run "cmd /c reg delete ""HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services" & subkey & """ /f",0,true SRV_msg="":on error resume next:SRV_msg=WshShell.RegRead(SRV_reg):on error goto 0'嘗試讀這個(gè)服務(wù) if SRV_msg>"" then SRV="刪失敗" & subkey else SRV="刪成功" & subkey end if end if else 'Service.ChangeStartMode(Service_mode)'本來(lái)用這句就可以了,能得到最好的兼容性,但權(quán)限問(wèn)題會(huì)造成不確定的無(wú)效 Delay=0:if start=5 then Delay=1:Start=2'預(yù)設(shè)不延時(shí)啟動(dòng)(具體秒在Control\AutoStartDelay) TryWrtReg "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services" & subkey & "\DelayedAutostart",Delay,"REG_DWORD" TryWrtReg "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services" & subkey & "\Start" ,Start,"REG_DWORD" end if FOREXIT=1'只可能有一個(gè)同名服務(wù),不需要完成所有循環(huán) end if if FOREXIT=1 then exit for Next end if if FOREXIT=1 then exit for Next Set ObjServices = nothing End Function
問(wèn)題未解決?付費(fèi)解決問(wèn)題加Q或微信 2589053300 (即Q號(hào)又微信號(hào))右上方掃一掃可加博主微信
所寫(xiě)所說(shuō),是心之所感,思之所悟,行之所得;文當(dāng)無(wú)敷衍,落筆求簡(jiǎn)潔。 以所舍,求所獲;有所依,方所成!