Last active
October 6, 2023 15:07
-
-
Save Prince-of-sea/784e6e0bea0e7872ccaa693d34b59deb to your computer and use it in GitHub Desktop.
Dropboxがアップデートするごとにレジストリ復活してうざいので
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env python3 | |
| import subprocess | |
| import os | |
| import re | |
| # 管理者権限必須 | |
| # pyinstaller対応版 | |
| # https://qiita.com/nonzu/pxs/b4cb0529a4fc65f45463 | |
| def subprocess_args(include_stdout=True): | |
| if hasattr(subprocess, 'STARTUPINFO'): | |
| si = subprocess.STARTUPINFO() | |
| si.dwFlags |= subprocess.STARTF_USESHOWWINDOW | |
| env = os.environ | |
| else: | |
| si = None | |
| env = None | |
| if include_stdout: ret = {'stdout': subprocess.PIPE} | |
| else: ret = {} | |
| ret.update({'stdin': subprocess.PIPE, 'stderr': subprocess.PIPE, 'startupinfo': si, 'env': env }) | |
| return ret | |
| s = subprocess.check_output(['reg', 'query', 'HKEY_CLASSES_ROOT\PackagedCom\Package'], text=True, shell=True, **subprocess_args(False)) | |
| for r in (str(s).split('\n')): | |
| if re.search(r'DropboxInc.Dropbox', r): subprocess.run(['reg', 'delete', r, '/f'], text=True, shell=True, **subprocess_args(True)) |
Author
Prince-of-sea
commented
Oct 6, 2023

Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment