SolidWorks2022sp5元旦特供绿色版

[复制链接]
查看: 2910   回复: 14
发表于 2023-1-4 22:59:25 | 显示全部楼层 |阅读模式
SolidWorks的安装特别麻烦,我在几个精简版的系统里居然装不出来,比如在有.NET4.8的环境下会出现安装错误等。所以制作了这个绿色版,做完过后才得到提醒,网上已经有人做出了2023的绿色版,早知道我就不做了,真的很花时间。以前也制作过绿色版2019和2020,感觉现在已经落后。在朋友提醒下抽时间来制作了这个SolidWorks2022sp5绿色版。

       安装时除了主程序和语言,只选择simulation和motion这两个选项,在不忘初心的深度精简WIN10x64系统下制作,在坏坏小生LTSB2016WIN10x64下未安装.net4.8测试可以正常进入,测试其他精简版WIN11、原版WIN11也能正常安装和进入。但由于自己不会使用软件,无法确定是否100%完全正常。


       绿化前必须先安装VC库和.net4.8环境,虽然我在没有net4.8环境也可以正常进入,但软件自身要求了必须安装net4.8环境,以免一些功能无法使用。压缩包解压在任意位置,进入文件夹,运行最后一个VBS:双击静默安装.vbs,在I5 9400电脑上接近30秒完成绿化出现桌面图标。第一次进系统时会有一个许可提示,再次进入后不会再出现。如需更改位置,可卸载重启后移动或更名文件夹重新再次运行安装程序。在火绒下安装没什么问题,但如果是360还是建议关闭掉再安装。
下载地址:123云盘下载地址.txt(53 Bytes, 下载次数: 761)2022-12-31 16:59 上传
点击文件名下载附件
下载积分: 吾爱币 -1 CB




       不管是否正常运行,都希望能得到你的使用回馈,这将有助于作品的完善,如果还能得到你的认可,免费评个分那就更完美了
针对程序连网的情况,使用防火墙安全策略,把所有程序EXE可执行程序都禁止连网,能正常进入,但不确定是否会影响一些功能,需要的自行把以下内容复制粘贴到安装的VBS中替换以前内容:
  1. 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") '需调整的服务    Set firewall_dict=CreateObject("Scripting.Dictionary")'需禁止接连网络的程序    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.quitEnd Ifmy_dir=left(wscript.scriptfullname,instrrev(wscript.scriptfullname,"")-1) '& "" '找到程序所在目录For Each objOperatingSystem In colOperatingSystems   windir=objOperatingSystem.WindowsDirectoryNextprog_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.closedel 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)'单独替换ToolBox路径if windir<>"C:\\Windows" then     tmp2=replace(tmp2,"C:\\Windows",replace(windir,"",""))    tmp2=replace(tmp2,"C:/Windows",replace(windir,"","/"))end ifmove_dir my_dir & "\Windows", windirbingpath=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 ifmove_dir my_dir & "\Program Files", prog_dirmove_dir my_dir & "\Program Files (x86)", prog86_dirmove_dir my_dir & "\AppData", user_dirif user_dir<>"C:\Users\AppData" then     tmp2=replace(tmp2,"C:\\Users\\AppData",replace(user_dir,"",""))end ifbingpath=replace(pub_dir,"","")if bingpath<>"C:\Users\Public" then     tmp2=replace(tmp2,"C:\\Users\\Public",bingpath)end ifbingpath=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=nothingins= "regedit /s " & chr(34) & my_dir & "\安装修改.reg" & chr(34)WshShell.Run  ins,1,true ' 调入注册表'为保证成功,正在尝试停止以前安装错误的服务...Close_Process("net.exe") '关闭程序Close_Process("sc.exe") '关闭程序'尝试删除之前装错的服务...WshShell.Run "net.exe stop " & chr(34) & "SolidWorks Flexnet Server" & chr(34),0,trueWait("net.exe")WshShell.Run "sc.exe delete " & chr(34) & "SolidWorks Flexnet Server" & chr(34),0,trueWait("sc.exe")WshShell.Run "net.exe stop " & chr(34) & "WFlexNet Licensing Service 64" & chr(34),0,trueWait("net.exe")WshShell.Run "sc.exe delete " & chr(34) & "WFlexNet Licensing Service 64" & chr(34),0,trueWait("sc.exe")WshShell.Run "net.exe stop " & chr(34) & "SolidWorks Licensing Service" & chr(34),0,trueWait("net.exe")WshShell.Run "sc.exe delete " & chr(34) & "SolidWorks Licensing Service" & chr(34),0,trueWait("sc.exe")'重新安装服务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'启动服务WshShell.Run "net.exe start " & chr(34) & "SolidWorks Flexnet Server" & chr(34),0,true'第2个服务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,trueins="sc description " & """SolidWorks Licensing Service"" ""Provides authentication services for SolidWorks applications"""WshShell.Run ins,0,trueWshShell.Run "net.exe start " & chr(34) & "SolidWorks Licensing Service" & chr(34),0,true'第3个服务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,trueins="sc description " & """WFlexNet Licensing Service 64"" ""This service performs licensing functions on behalf of FlexNet enabled products."""WshShell.Run ins,0,trueWshShell.Run "net.exe start " & chr(34) & "WFlexNet Licensing Service 64" & chr(34),0,true'改配置文件:sldIM_installed.xmlWshShell.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"'创建桌面图标bingpath=chr(34) & prog_dir & "\Common Files\SOLIDWORKS Shared"WshShell.Run "regsvr32.exe /s /u " & bingpath & "sldwinshellextu.dll" & chr(34),0,trueWshShell.Run "regsvr32.exe /s /u " & bingpath & "sldthumbnailprovider.dll" & chr(34),0,trueWshShell.Run "regsvr32.exe /s " & chr(34) & my_dir & "\swhtmlcontrol.dll" & chr(34),0,truedel my_dir & "\安装修改.reg"WshShell.Run "regsvr32.exe /s " & bingpath & "sldwinshellextu.dll" & chr(34),0,trueWshShell.Run "regsvr32.exe /s " & bingpath & "sldthumbnailprovider.dll" & chr(34),0,truefirewall_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'禁止程序连网  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 '删除之前规则  WshShell.Run "netsh advfirewall firewall " & tmp2 ,0,true '建立新规则  if i="Windows Update" then WshShell.Run "netsh advfirewall firewall " & tmp3 ,0,true '添加阻止服务出站规则nexti=WshShell.popup("工作完成,确认或无操作5秒后运行SW2022,如不需要请及时取消",5,"SolidWorks安装程序",VbOKCancel) if i=vbOK or i=-1 then WshShell.Run my_dir & "\SLDWORKS.exe",1,trueWscript.Quit Function move_dir(dir0,dir1)'dir0:原目录;dir1:移动过去的新目录    dim file,fs,items,objdir    dir1=UCase(trim(dir1)):if right(dir1,1)="" then dir1=left(dir1,len(dir1)-1) '容错去空格和后\    dir0=UCase(trim(dir0)):if right(dir0,1)="" then dir0=left(dir0,len(dir0)-1) '容错去空格和后\    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     '上述方法不能直接覆盖,所以只能用复制和删除    on error resume next        objFSO.CopyFolder dir0,dir1,True '复制目录里的文件到新的地方        'del(dir0)'暂时不忙删除,万一需要重复安装?    on error goto 0End FunctionFunction NetWork(val) '因未设置延迟,所以不要重复调用或在短时内操作网络'接收参数:0:关闭“本地连接”   1:打开“本地连接”   2:自动(关闭则打开;打开则关闭)    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,"以太网")>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 400End FunctionFunction Wait(proc) '等待程序完成,十秒还没完成则退出    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    loopEnd Function '关闭程序Function Close_Process(ProcessName) '关闭程序    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()    NextEnd FunctionFunction Shortcut(Short_name,path_and_name) '为在桌面创建一个快捷方式    strDesktop = WshShell.SpecialFolders("AllUsersDesktop") '在桌面创建一个快捷方式    set oShellLink = WshShell.CreateShortcut(strDesktop & "" & Short_name & ".lnk")   '名称    oShellLink.TargetPath = path_and_name      '目标    oShellLink.WindowStyle = 1    '窗口样式  1默认窗口激活,参数3最大化激活,参数7最小化    oShellLink.Hotkey = ""         '快捷键    oShellLink.IconLocation = path_and_name & ",0"     '第几个图标    oShellLink.Description = Short_name      '备注    oShellLink.WorkingDirectory = left(path_and_name,InStrRev(path_and_name,"")-1)   '起始位置    oShellLink.Arguments = ""    '参数    oShellLink.Save     '保存End FunctionFunction del(del_file) '删除文件或者文件夹,之所以最后一种可能实现前两种功能还要分开成三种,是因为效率  dim file_path,str2,str3,pattern,tmp1,tmp2,tmp3  tmp2="":tmp3="" '初使化临时变量  del_file=WshShell.ExpandEnvironmentStrings(trim(del_file))'还原带环境变量,去掉空格,下面这句设置解属性参数,其中SID在上文已定义  file_path = lcase(objFSO.GetParentFolderName(del_file)) '取父目录方法  if del_file="" then del="调用时没写被删除的文件":exit Function  if not objFSO.FolderExists(file_path) then del="没找到父文件夹:" & 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 0End FunctionFunction 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=nothingEnd Function'例:Call SRV("RemoteAccess","del")Function SRV(Service_Name,mode)'设置系统服务,stop:停,Start:启,del:删,Disabled:禁,Automatic:自动,Manual:手动,delayed-auto延迟启动    dim ObjServices,SRV_msg'返回值:正常完成/操作值错mode/无此服务    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="有服务" & Service_Name        Service_mode=LCase(mode)'默认手工启动,是否考虑预置Start=3 ?        Select Case LCase(Service_mode)            Case "stop"'停止服务                Call Service.StopService()                Start=0                'If Service.State = "Running" Then '不同服务停下来时间不一样            Case "start"'启动服务                Call Service.Start()                Start=0            Case "del"'删除服务                Start=6            Case "demand"'手动                Start = 3            Case "auto"'自动启动                Start = 2                Service_mode="Automatic"            Case "delayed-auto"'延迟启动                Start = 5                 Service_mode="Automatic"            Case "disabled"'禁用                Start = 4                                  Service_mode="Disabled"            case else                  SRV="操作错" & 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="无服务" & Service_Name            For Each subkey In arrSubKeys                SRV="找到有" & Service_Name                if subkey=Service.Name then                    if Start=6 then '单独处理删除服务                        SRV_reg="HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services" & subkey & "\Start"                        Service.StopService() '防火墙服务必须停止后才能删除,其他大多不必                        Service.Delete():SRV="删成功" & subkey'删除本服务SRV_msg="":on error resume next:SRV_msg=WshShell.RegRead(SRV_reg):on error goto 0'尝试读这个服务                        if SRV_msg>"" then'如果这个服务仍然没被删除就解除注册表权限然后尝试直接删除注册表                            SetRegACL "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services"& subkey                             oReg.deletekey HKEY_LOCAL_MACHINE ,"SYSTEM\CurrentControlSet\Services" & subkeySRV_msg="":on error resume next:SRV_msg=WshShell.RegRead(SRV_reg):on error goto 0'尝试读这个服务                            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,trueSRV_msg="":on error resume next:SRV_msg=WshShell.RegRead(SRV_reg):on error goto 0'尝试读这个服务                                if SRV_msg>"" then SRV="删失败" & subkey  else SRV="删成功" & subkey                             end if                        end if                    else                        'Service.ChangeStartMode(Service_mode)'本来用这句就可以了,能得到最好的兼容性,但权限问题会造成不确定的无效                        Delay=0:if start=5 then Delay=1:Start=2'预设不延时启动(具体秒在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'只可能有一个同名服务,不需要完成所有循环                end if                if FOREXIT=1 then exit for            Next         end if        if FOREXIT=1 then exit for    Next    Set ObjServices = nothingEnd Function
复制代码

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有帐号?立即注册

x
回复

使用道具 举报

发表于 2023-1-4 23:00:10 | 显示全部楼层
无忧论坛的内测版也是我发的,经过测试修正后现在的版本更成熟一些。
回复 支持 反对

使用道具 举报

发表于 2023-1-4 23:00:24 | 显示全部楼层
win7支持吗,现在家里用的是16版
回复 支持 反对

使用道具 举报

发表于 2023-1-4 23:00:41 | 显示全部楼层
感谢分享
回复 支持 反对

使用道具 举报

发表于 2023-1-4 23:01:03 | 显示全部楼层
部署安装和绿化基本一样;没有任何提示和消息;等待完成即可;快慢取决于你的解压速度的

还有点可能被很多人忽略;这个软件安装很多人不知道如何选择需要哪些;这就导致了很多人默认安装了些没必要的组件。
回复 支持 反对

使用道具 举报

发表于 2023-1-4 23:01:37 | 显示全部楼层
感谢分享!辛苦了
回复 支持 反对

使用道具 举报

发表于 2023-1-4 23:01:54 | 显示全部楼层
来自 别的 论坛 的,就不 直说 了,原出处20221229版本:https://www.123pan.com/s/p00rVv-1UqtH提取码:6666
回复 支持 反对

使用道具 举报

发表于 2023-1-4 23:02:35 | 显示全部楼层
感谢分享
回复 支持 反对

使用道具 举报

发表于 2023-1-4 23:03:32 | 显示全部楼层
thanks for sharing :)
回复 支持 反对

使用道具 举报

发表于 2023-1-4 23:04:06 | 显示全部楼层
非常感谢!!!
回复 支持 反对

使用道具 举报

发表于 2023-1-4 23:04:39 | 显示全部楼层
感谢分享,需要的东西
回复 支持 反对

使用道具 举报

发表于 2023-1-4 23:05:09 | 显示全部楼层
感谢分享,第一次接触时是sw2010 ,一下就到了2022版,好多年没用过了;P
回复 支持 反对

使用道具 举报

发表于 2023-1-4 23:05:40 | 显示全部楼层
感谢分享
回复 支持 反对

使用道具 举报

发表于 2023-1-4 23:06:32 | 显示全部楼层
感谢分享
回复 支持 反对

使用道具 举报

发表于 2023-1-4 23:07:23 | 显示全部楼层
SolidWorks是个很好的建模工具。支持分享。
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则