Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/env python
- # -*- coding: utf-8 -*-
- # Filename: file_visibility_options.py
- # Version: 1.00
- # Author: Jeoi Reqi
- """
- This script allows users to toggle visibility settings related to files and file extensions in Windows by modifying registry values. It provides options to enable or disable hidden files, file extensions, and super hidden files. The script verifies the registry path before presenting the options menu.
- Requirements:
- - Python 3.x
- - Windows operating system
- Functions:
- - set_registry_value(key, value_name, value_data): Sets a registry value.
- - main(): Main function to display the options menu and handle user input.
- Usage:
- 1. Run the script in a Python environment.
- 2. Follow the on-screen instructions to enable or disable file visibility settings.
- 3. Type '0' to exit the script.
- Additional Notes:
- - This script modifies the Windows registry. Exercise caution when using it.
- - Always verify the changes made by the script in the registry editor.
- """
- import subprocess
- def set_registry_value(key, value_name, value_data):
- """
- Set a registry value.
- Args:
- key (str): Registry key path.
- value_name (str): Name of the registry value.
- value_data (int): Data to set for the registry value.
- Returns:
- None
- """
- subprocess.run(
- [
- "reg",
- "add",
- key,
- "/t",
- "REG_DWORD",
- "/v",
- value_name,
- "/d",
- str(value_data),
- "/f",
- ],
- stdout=subprocess.DEVNULL,
- stderr=subprocess.DEVNULL,
- )
- def main():
- """
- Display the options menu and handle user input.
- Returns:
- None
- """
- while True:
- print(
- "-------------------------------------------------------------------------------\n"
- "::VERIFY PATH::\n"
- "[HKEY_CURRENT_USER\\Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Advanced]\n"
- "-------------------------------------------------------------------------------\n"
- )
- print("\tChoose an option:\n")
- print("\t1. Enable Hidden Files")
- print("\t2. Disable Hidden Files")
- print("\t3. Enable File Extensions")
- print("\t4. Disable File Extensions")
- print("\t5. Enable Super Hidden Files")
- print("\t6. Disable Super Hidden Files\n")
- choice = input("\tEnter your choice (Or type '0' to exit): ")
- if choice == "0":
- print("\n\tExiting...\tGoodBye!\n")
- break
- elif choice == "1":
- set_registry_value(
- "HKEY_CURRENT_USER\\Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Advanced",
- "Hidden",
- 1,
- )
- print("\n\n\t- Hidden Files Enabled!\n")
- elif choice == "2":
- set_registry_value(
- "HKEY_CURRENT_USER\\Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Advanced",
- "Hidden",
- 0,
- )
- print("\n\n\t- Hidden Files Disabled!\n")
- elif choice == "3":
- set_registry_value(
- "HKEY_CURRENT_USER\\Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Advanced",
- "HideFileExt",
- 0,
- )
- print("\n\n\t- File Extensions Enabled!\n")
- elif choice == "4":
- set_registry_value(
- "HKEY_CURRENT_USER\\Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Advanced",
- "HideFileExt",
- 1,
- )
- print("\n\n\t- File Extensions Disabled!\n")
- elif choice == "5":
- set_registry_value(
- "HKEY_CURRENT_USER\\Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Advanced",
- "ShowSuperHidden",
- 1,
- )
- print("\n\n\t- Super Hidden Files Enabled!\n")
- elif choice == "6":
- set_registry_value(
- "HKEY_CURRENT_USER\\Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Advanced",
- "ShowSuperHidden",
- 0,
- )
- print("\n\n\t- Super Hidden Files Disabled!\n")
- else:
- print("\n\n\t! Invalid choice !\n")
- if __name__ == "__main__":
- main()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement