A simple C# console application that provides quick system power management commands through an interactive command-line interface.
- Sleep Mode: Put your computer into suspend/sleep mode
- Shutdown: Safely shutdown your computer
- Restart: Restart your computer
- Clear Console: Clear the terminal screen
- Interactive Interface: User-friendly command prompt with colorful ASCII art
| Command | Description |
|---|---|
sleep |
Put the computer into sleep/suspend mode |
off |
Shutdown the computer |
reboot |
Restart the computer |
clear |
Clear the console screen |
quit |
Exit the application |
- Windows operating system
- .NET Framework (compatible with the project's target framework)
- Administrator privileges may be required for some power management operations
-
Clone this repository:
git clone <repository-url> cd sleep_trigger
-
Open the solution in Visual Studio:
start sleep_trigger.sln
-
Build the solution (Ctrl+Shift+B in Visual Studio)
- Run the compiled executable or start the application from Visual Studio
- You'll see the ASCII art banner and available commands
- Type any of the supported commands at the prompt:
- Type
sleepto put your computer to sleep - Type
offto shutdown your computer - Type
rebootto restart your computer - Type
clearto clear the console - Type
quitto exit the application
- Type
_ __ __ _
/\ | | | \/ | /\ (_)
/ \ _ __ __| | __ ___ ____ _ _ __ | \ / | / \ _ __ ___ _ _ __
/ /\ \ | '__/ _` |/ _` \ \ /\ / / _` | '_ \ | |\/| | / /\ \ | '_ ` _ \| | '_ \
/ ____ \| | | (_| | (_| |\ V V / (_| | | | | | | | | / ____ \| | | | | | | | | |
/_/ \_\_| \__,_|\__,_| \_/\_/ \__,_|_| |_| |_| |_| /_/ \_\_| |_| |_|_|_| |_|
--------------------------------------------------------
🔹 Available Commands:
sleep → Suspend (Sleep Mode)
off → Shutdown
reboot→ Restart
clear → Clear console
quit → Exit
--------------------------------------------------------
Say Magic Word> sleep
Putting the laptop to sleep...
The application uses Windows API calls through P/Invoke:
SetSuspendStatefrompowrprof.dllfor sleep functionalityProcess.Startwithshutdowncommand for shutdown and restart operations
This application requires system-level permissions to perform power management operations. Always ensure you save your work before using shutdown or restart commands.
- Fork the repository
- Create a feature branch
- Make your changes
- Submit a pull request
This project is licensed under the MIT License - see the LICENSE file for details.
Created by Ardawan M Amin