Skip to main content

osn-windows-cmd: Simplify Windows Command-Line Interactions

osn-windows-cmd is a Python library designed to streamline working with common Windows command-line tools. It provides convenient functions and parameter handling for commands like netstat, shutdown, and taskkill, abstracting away the complexities of constructing and executing these commands directly.

Key Features

  • Simplified Command Execution: Construct and execute Windows commands with intuitive function calls and parameter management.
  • Structured Output Parsing: Process the output of commands like netstat into easy-to-use Pandas DataFrames.
  • Cross-Compatibility: Designed to work seamlessly across various Windows versions.
  • Clear Documentation and Examples: Well-documented code and usage examples to get you started quickly.

Installation

  • With pip:

    pip install osn-windows-cmd
    
  • With git:

    pip install git+https://github.com/oddshellnick/osn-windows-cmd.git
    

Current Functionality

  • netstat: Retrieve system network statistics, including active connections, routing tables, and interface information. Parse the returned data directly into Pandas DataFrames. Conveniently find free ports on localhost.
  • shutdown: Initiate shutdowns and restarts of local or remote Windows systems with various options (forceful shutdown, reason logging, timeout period, etc.).
  • taskkill: Terminate processes based on various criteria such as image name or process ID.

Usage Examples

taskkill:

from osn_windows_cmd.taskkill.parameters import ImageName
from osn_windows_cmd.taskkill import taskkill_windows
# Forcefully kill all notepad.exe processes
taskkill_windows("/F", selectors=ImageName("notepad.exe"))

netstat:

from osn_windows_cmd.netstat import get_netstat_connections_data
# Get all active TCP connections
connections = get_netstat_connections_data(protocol="TCP")

shutdown:

from osn_windows_cmd.shutdown.parameters import ShutdownReason, ShutdownReasonType, ShutdownType
from osn_windows_cmd.shutdown import shutdown_windows
# Restart the local machine after 60 seconds, logging the reason
shutdown_windows(ShutdownType.restart, time_out_period=60,
                 shutdown_reason=ShutdownReason(ShutdownReasonType.planned, 4, 2))

More comprehensive usage examples and detailed documentation can be found within the project's source code docstrings.

Future Notes

osn-windows-cmd is an ongoing project and will be expanded to support more Windows commands in the future. We welcome contributions from the community. Feel free to suggest new commands to be added or submit pull requests with your own implementations.

Release files for osn-windows-cmd 1.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for osn-windows-cmd 1.1.0
File Size Uploaded
osn_windows_cmd-1.1.0.tar.gz 15.0 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for osn-windows-cmd 1.1.0
File Interpreter ABI Platform
osn_windows_cmd-1.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 32.8 kB

Release files / osn_windows_cmd-1.1.0.tar.gz

Download URL osn_windows_cmd-1.1.0.tar.gz
Size 15.0 kB
Tags Source
SHA-256 checksum
How to use checksums
b4737a7d0b099a39103999302c3ec6bee87ea52b17ca4f3a8bc73c57b5a6b3c8
BLAKE2b-256 checksum
How to use checksums
38382f9efea57c66eccaa0906d8dcac6c038d9b6bc7a7f63f74448d3bcb7db5b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.12.9

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jun 19, 2025.

Transparency log

Release files / osn_windows_cmd-1.1.0-py3-none-any.whl

Download URL osn_windows_cmd-1.1.0-py3-none-any.whl
Size 17.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
8406b638700797b9b5c3541e14b2c128032fe7fbadcc429370f96f633b82b4cd
BLAKE2b-256 checksum
How to use checksums
db06dd054a930d794bac731e31123fc2c6f7bc00a1a0589cae6d0714cc1cee24
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.12.9

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jun 19, 2025.

Transparency log

Release history Release notifications | RSS feed

This release

1.1.0 This release

2 release files

1.0.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page