Skip to content

Instantly share code, notes, and snippets.

@Prince-of-sea
Last active October 6, 2023 15:07
Show Gist options
  • Select an option

  • Save Prince-of-sea/784e6e0bea0e7872ccaa693d34b59deb to your computer and use it in GitHub Desktop.

Select an option

Save Prince-of-sea/784e6e0bea0e7872ccaa693d34b59deb to your computer and use it in GitHub Desktop.
Dropboxがアップデートするごとにレジストリ復活してうざいので
#!/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))
@Prince-of-sea
Copy link
Author

Dropbox_reg_killer exe

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