Commander is a Python + PyQt application that manages a collection of handy shortcuts—each shortcut can be:
- A simple CMD command (e.g.,
ping google.com
) - A PowerShell command or script (e.g.,
.ps1
files) - An .exe or .bat program
- Commands with placeholders (like
{host}
) that prompt the user at runtime
It provides:
- A table with name, command, tags, and category.
- Light/Dark theme toggle switch.
- Search bar for filtering by text in name/command/tags/category.
- A category sidebar for advanced filtering.
- Two-step execution (Execute → Confirm) to avoid accidental runs.
- Add/Edit/Delete for new shortcuts (persisted in a JSON file).
- Support for multiline PowerShell scripts via external
.ps1
or an embedded approach.
-
Searchable Table
- Real-time filter by name, command, tags, or category.
- Category sidebar to quickly navigate or show
(All Categories)
.
-
Light/Dark Mode
- A toggle switch in the search bar area.
- Setting saved to JSON so it’s remembered next time.
-
Two-Step Confirmation
- Prevents accidental command execution by requiring “Execute” → “Confirm.”
-
Add/Edit/Delete Shortcuts
- Add new shortcuts with a ShortcutDialog (input name, command, description, tags, category, etc.).
- Option to mark “Requires user input?” for placeholder substitution.
- Link
.exe
,.bat
,.ps1
, or embed multiline code.
-
Placeholder Logic
- If
requires_input
is set, Commander scans the command for tokens like{host}
. - Prompts the user for each placeholder at runtime.
- Substitutes them before execution.
- If
-
Automatic Shell Detection
- If the command ends with
.exe
, Commander runs it directly. - If
.ps1
, it uses PowerShell. - Otherwise, defaults to
cmd /k
.
- If the command ends with
-
Easy Portability
- All data stored in
shortcuts.json
in the same folder. - Just drop the folder on a flash drive—Commander references relative paths if you choose.
- All data stored in
- Python 3.7+ (recommended)
- PyQt5 (For the GUI).
- Windows environment for best results (Currently all commands are Windows specific).
Install dependencies:
bash
Copy code
pip install pyqt5
-
Clone or copy the Commander files (including
main.py
,shortcuts.json
, etc.) to a folder. -
Open a terminal or command prompt in that folder.
-
Launch:
bash
Copy code
=======
- The Commander window appears. You’ll see:
- A search bar (with a theme toggle switch).
- A category sidebar (left).
- A table listing your shortcuts (right).
- Bottom buttons for adding/editing/deleting.
- An “Execute” button.
- Click “Add Shortcut.”
- Fill in:
- Name: A label (e.g., “Ping Google”).
- Command: The command or path (e.g., “ping google.com” or
E:\HwInfo\HwInfo64.exe
). - Description: Optional brief text.
- Tags: Comma-separated tags (e.g.,
network, ping
). - Category: For grouping (e.g.,
Networking
). - Requires user input?: If you have placeholders like
{host}
in Command, check this box.
- Press OK. The new shortcut is saved to JSON and appears in the table.
- Select the row in the table.
- Edit Shortcut or Delete Shortcut:
- Edit opens the same dialog, pre-filled. Change fields, then OK.
- Delete asks “Are you sure?”
- Changes are saved automatically to
shortcuts.json
.
- Select the row you want.
- Click Execute.
- Button changes to Confirm. Click again → the command runs.
- If it’s a
.exe
, it launches. If.ps1
, it uses PowerShell. Otherwise, default tocmd /k
. - If the command has placeholders like
{host}
, you’ll be prompted for each placeholder first.
Recommended: Put your multiline script in a .ps1
file. Then your “Command” might be:
arduino
Copy code
powershell.exe -NoExit -File "E:\Commander\Scripts\FindRecentFiles.ps1"
(Or you can embed multiline code directly in the Command field and write it to a temp file on-the-fly, but that requires more code changes. See the documentation for details.)
If you want a single-file .exe
:
-
Install PyInstaller:
bash
Copy code
pip install pyinstaller
-
In your folder, run:
bash
Copy code
pyinstaller --onefile main.py
-
It creates
dist/main.exe
. Putshortcuts.json
(and any.ps1
scripts you need) beside that.exe
.
- Placeholder logic not working? Make sure you don’t overwrite the local
command
variable after replacements, or skip therequires_input
check. - Not picking up
.exe
? Double-check your extension logic or see if the path is spelled correctly. - No shortcuts appear? Possibly your
shortcuts.json
is empty or in a different folder. Add debug prints or check the console for file paths.
Feel free to open a PR or share improvements:
- More advanced search or category logic.
- Additional shells (e.g. WSL?).
- Integration with external tools or an embedded console approach.
- Much more robust handling for .exe creation with better instructions
- Groups that can run multiple commands at a time
- Need more ideas for great commands to add to default JSON
- Resizing columns correctly so long commands don't take up the whole window
Commander is licensed under the MIT License. You can freely modify and distribute it.