=Start=
缘由:
简单记录一下如何在Windows/macOS系统上进行软件的安装和卸载(主要是想记录命令行下的安装,为后面的静默安装/编写小白也容易理解的安装教程/工具做准备,可视化的点击交互式安装不是重点,一笔带过即可),方便后面参考。
正文:
参考解答:
安装
Windows-图形化界面
鼠标双击(然后跟着指示操作即可)
鼠标右键-以管理员身份运行(A)
Windows-命令行终端
setup.exe
# 如果路径不太好输入的话,可以先打开一个CMD终端,然后用鼠标把软件拖动到终端上就会有路径了
> "C:\SomeFolder\setup.exe"
> "C:\SomeFolder\setup.exe" /VERYSILENT /SUPPRESSMSGBOXES /NORESTART
setup.msi
> msiexec /i C:\setup.msi /qn
> msiexec /i C:\setup.msi /qn /norestart
选项说明
# msiexec
/quiet, /q, qn Fully silent mode (静默安装)
/passive Unattended mode, shows progress bar only.
/norestart Do not restart the system after the installation
/forcerestart Restart the system after installation is complete
/log, /l Enable Logging
# setup.exe
/SILENT Runs the installer in silent mode (The progress window is displayed)
/VERYSILENT (静默安装)Very silent mode. No windows are displayed.
/SUPPRESSMSGBOXES Suppress message boxes. Only has an effect when combined with ‘/SILENT’ and ‘/VERYSILENT’.
/NOCANCEL Disables cancelling the installation process.
/NORESTART Prevents installer from restarting the system even if it’s necessary.
/DIR="x:\dirname" Overrides the default install directory.
macOS-图形化界面
鼠标双击(然后跟着指示操作即可)
macOS-命令行终端
$ sudo installer -pkg /path/to/filename.pkg -target /
卸载
Windows-图形化界面
Windows控制面板 – 卸载程序 – 选定应用右键卸载 #Windows7
Windows设置 – 应用和功能 – 选定应用进行卸载 #Windows10
有很多应用都有此功能,在此不一一列举了
Windows-命令行终端
// Silently uninstall the msi package:
> msiexec /x C:\setup.msi /qn
// Silently uninstall the msi package by the product code:
> msiexec /x {XXXXXXXX-9215-4780-AAC6-01FD101DC931} /qn
// wmi
> wmic product where name="my_product_name" call uninstall
// powershell
powershell> (Get-WmiObject -Query "SELECT * FROM Win32_Product WHERE Name like '%Partial Name%'").uninstall()
HKLM\Software\Microsoft\Windows\CurrentVersion\Uninstall
HKLM\SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\Uninstall\
Every program that properly installs itself according to Microsoft’s guidelines makes a registry entry in HKLM\Software\Microsoft\Windows\CurrentVersion\Uninstall. Usually, the key for the program will be its GUID, or else the name of the program. Within that key will be an entry called UninstallString. This contains the command to execute to uninstall the program.
If you already know ahead of time what you will be uninstalling, it should be easy enough to just put that in your batch file. It gets tricky when you try to automate that process though. You can use the reg command to get data from the registry, but it returns a lot of text around the actual value of a given key, making it hard to use. You may want to experiment with using VBscript or PowerShell, as they have better options for getting data from the registry into a variable.
macOS-图形化界面
直接将app拖到废纸篓里就行
很多macOS应用,比如CleanMyMac
macOS-命令行终端
- 简单的是直接删除特定的 .app 目录
- 复杂的可能还有一些配置/文件存放在了其它目录需要一起删除才能完整地进行卸载
- 对于有保活功能的软件来说,需要先杀掉相关进程然后同步删除相关目录,才能完成卸载
mdfind
lsof
参考链接:
Running .exe in command prompt
https://superuser.com/questions/876933/running-exe-in-command-prompt
The Inno Setup install parameters that are required for silent installation.
https://www.silentinstall.org/inno_setup/
Unattended Installation for Windows
http://www.elliecomputing.com/en/OnlineDoc/ecmerge_EN/111706292.asp
Silent installation of a MSI package
https://stackoverflow.com/questions/8560166/silent-installation-of-a-msi-package
The Silent Install options for the Windows installer (msiexec)
https://www.silentinstall.org/msiexec/
Silent install parameters for Windows applications
https://www.novatec-gmbh.de/en/blog/windows-silent-install-parameters/
How to Uninstall .exe silently in c++
https://stackoverflow.com/questions/60994542/how-to-uninstall-exe-silently-in-c
SOLVED: Command Line To Uninstall Software EXE’s or .MSI’s
https://www.urtech.ca/2019/09/solved-command-line-to-uninstall-software-exes-or-msis/
Uninstalling programs silently via CMD
https://superuser.com/questions/234104/uninstalling-programs-silently-via-cmd
Microsoft Standard Installer Command-Line Options
https://docs.microsoft.com/en-us/windows/win32/msi/standard-installer-command-line-options
How to Completely Remove Apps & Software in Mac OS X by Manual Terminal Uninstall
https://osxdaily.com/2014/07/31/manual-complete-app-removal-mac-os-x-terminal/
How to uninstall apps on your Mac
https://support.apple.com/en-us/HT202235
How to uninstall programs on a Mac
https://macpaw.com/how-to/uninstall-apps-on-mac-os-x
Here’s how to delete programs on Mac
https://cleanmymac.com/blog/uninstall-programs-mac
=END=
《 “Windows/macOS系统上如何进行软件安装和卸载” 》 有 5 条评论
配置本地安全策略
https://docs.microsoft.com/zh-cn/windows/security/threat-protection/security-policy-settings/how-to-configure-security-policy-settings
`
# 本地安全策略
secpol.msc
`
安全策略设置
https://docs.microsoft.com/zh-cn/windows/security/threat-protection/security-policy-settings/security-policy-settings
`
# 本地组策略
gpedit.msc
`
6416 (S) :系统已识别新的外部设备。
https://docs.microsoft.com/zh-cn/windows/security/threat-protection/auditing/event-6416
审核 PNP 活动
https://docs.microsoft.com/zh-cn/windows/security/threat-protection/auditing/audit-pnp-activity
Windows10系统-事件查看器
win+r => eventvwr
如何在Windows10系统用事件查看器筛选事件日志
https://jingyan.baidu.com/article/ea24bc39ac5fea9b62b33191.html
Where can I find logs on recent USB insertion in the Event Viewer? [duplicate]
https://superuser.com/questions/1096887/where-can-i-find-logs-on-recent-usb-insertion-in-the-event-viewer
Know if a USB is inserted into your Pc(Windows 10)
https://albertassaad.medium.com/know-if-a-usb-is-inserted-to-your-pc-windows-10-6d177758cf73
`
1- Enable the USB Logging option by accessing the Event Viewer:
a- Click on the Start Menu, Type Event Viewer
b-Expand Applications and Services Logs
c- Expand Microsoft/Windows/DriverFrameworks-UserMode/ and click on Operational
d- Right-click Operational on the menu click Enable Log, this will enable the logging in the Operational folder.
2- Now After you insert the USB open the Operational Folder and see the logs as below:
When a USB flash drive is connected, the first registered event record is Event ID 2003. So by perceiving the date and time stamp assigned to an Event ID 2003 record, you can tell accurately when a USB flash drive was attached to the system.
When a USB flash drive is disconnected, you seek for Event ID 2102 so you can know when it was removed.
`
Overview of USB Event Tracing for Windows
https://docs.microsoft.com/en-us/windows-hardware/drivers/usbcon/usb-event-tracing-for-windows
如何使用 Logman 捕获 USB 事件跟踪
https://docs.microsoft.com/zh-cn/windows-hardware/drivers/usbcon/how-to-capture-a-usb-event-trace
win10家庭版没有组策略怎么办?
https://www.zhihu.com/question/53834660
`
我有两个电脑,一个是win10家庭版一个是win10专业版。家庭版的没有组策略,很多功能用不了。我想问,有没有办法把专业版的组策略复制过来?应该不会受限于版本吧?
PS:虽然网上流传了专业版的密钥,但是感觉不靠谱、没敢用。万一我正版变盗版不就亏了。另外听说有的人家庭版升级专业版只要¥12,为啥我的要¥808呢?
==
请将以下4行命令复制并粘贴到记事本中,另存为bat文件,之后右击以管理员身份运行即可
pushd “%~dp0″
dir /b C:\Windows\servicing\Packages\Microsoft-Windows-GroupPolicy-ClientExtensions-Package~3*.mum >List.txt
dir /b C:\Windows\servicing\Packages\Microsoft-Windows-GroupPolicy-ClientTools-Package~3*.mum >>List.txt
for /f %%i in (‘findstr /i . List.txt 2^>nul’) do dism /online /norestart /add-package:”C:\Windows\servicing\Packages\%%i”
完成以上的步骤之后我们就可以通过命令 gpedit.msc 打开组策略了。
`
How to Uninstall the Symantec DLP Endpoint Agent
https://knowledge.broadcom.com/external/article/170287/how-to-uninstall-the-symantec-dlp-endpoi.html
`
@echo off
REM //////////////////////////////////////////////////////////////////////////////////
msiexec /uninstall {11012518-A235-4178-8041-ACA48E052C60} /q UNINSTALLPASSWORD=”pass123″
msiexec /uninstall {A0E68A60-E65E-4E14-A75B-998FF6B1ACCD} /q UNINSTALLPASSWORD=”pass123″
msiexec /uninstall {D668E870-0F50-477C-81ED-991D9768055B} /q UNINSTALLPASSWORD=”pass123″
REM //////////////////////////////////////////////////////////////////////////////////
`