Last active
March 24, 2024 13:32
-
-
Save y0n1/109b2de0315e079cbf2acdaf065ff3fa to your computer and use it in GitHub Desktop.
Removes file extension registration made by Visual Studio Code installer.
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/python | |
import sys, subprocess | |
def main(argv=None): | |
try: | |
query = [item.replace('REG_SZ', '').strip() for item in subprocess.check_output("reg query HKCR /v VSCode.* /s").splitlines() if len(item) > 0][0: -1] | |
queryItems = [(query[i],query[i+1]) for i in range(0, len(query), 2)] | |
for item in queryItems: | |
print("Deleting {0} from {1}".format(item[0], item[1])) | |
subprocess.check_output("reg delete {0} /v {1} /f".format(item[0], item[1])) | |
except subprocess.CalledProcessError as error: | |
print(error.output) | |
if __name__ == "__main__": | |
sys.exit(int(main() or 0)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment