批量脚本安装以安装和卸载.net

时间:2015-06-02 13:30:22

标签: .net windows batch-file vbscript

我最近的任务是创建一个将卸载然后重新安装.net 4.3.2的批处理脚本。我最近一直在学习如何创建批处理脚本。但我不确定如何创建可以安装程序的批处理脚本。我尝试在网上搜索没有运气。谁能告诉我如何做到这一点的信息?

1 个答案:

答案 0 :(得分:1)

按照@Cadburry的建议。这是我用于添加角色的代码。添加类似于卸载角色的内容,并根据需要对其进行编辑。

FOR /F "tokens=4-5 delims=. " %%A in ('VER') DO SET WindowsVersion=%%A%%B
SET "WindowsFeatures=Web-Static-Content, Web-Dir-Browsing, Web-Http-Errors, Web-Asp, Web-Asp-Net, Web-Http-Logging, Web-Stat-Compression, Web-Basic-Auth, Web-Windows-Auth, Web-Mgmt-Console, Web-Mgmt-Service, NET-Framework-Core, PowerShell-ISE, Desktop-Experience"
REM Add more for Server 2012 R2 and Win 8.1
IF %WindowsVersion% GTR 61 SET "WindowsFeatures=%WindowsFeatures%, Web-Net-Ext45, Web-Asp-Net45
ECHO(%WindowsFeatures%
POWERSHELL.EXE -Command "&{Import-Module ServerManager; Add-WindowsFeature %WindowsFeatures%}"
相关问题