Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Bluetooth Command-Line Switcher for Windows

A simple, lightweight command-line utility to quickly turn Bluetooth on or off in Windows 10 and Windows 11.

Why Does This Project Exist?

Windows does not provide a native, built-in command-line tool to directly control the Bluetooth radio state. While it's possible to disable the hardware adapter through Device Manager or with complex PowerShell scripts, there isn't a simple way to replicate the "On/Off" toggle found in the Action Center or Settings panel.

This tool was created to fill that gap. It provides a straightforward, single-purpose executable that allows users and scripts to easily manage the Bluetooth radio state without navigating any UI.

Features

  • Turn Bluetooth ON with a simple command.
  • Turn Bluetooth OFF with a simple command.
  • Acts as a software switch, not a hardware driver disabler.
  • Perfect for automation scripts, custom hotkeys, or quick access.
  • Single, portable executable file with no installation required.

How to Use

  1. Download the latest BluetoothSwitcher.exe from the Releases page.
  2. Place the executable in a convenient location (e.g., a folder included in your system's PATH).
  3. Open a command prompt (CMD), PowerShell, or Windows Terminal and run the following commands:
# To turn Bluetooth ON
.\BluetoothSwitcher.exe on

# To turn Bluetooth OFF
.\BluetoothSwitcher.exe off

Note: The first time you run the application, Windows may prompt you for permission to allow the app to control the device's radios. You must allow this for the tool to function correctly.

How It Works

This tool is a .NET 8 C# console application that utilizes the Windows Runtime (WinRT) API. It specifically uses the Windows.Devices.Radios namespace to find the system's Bluetooth radio and programmatically change its state via SetStateAsync(). This is the modern, recommended method for controlling radio states on Windows.

Building from Source

If you prefer to build the executable yourself, you can publish it as a single, self-contained file directly from Visual Studio.

Prerequisites

  • Visual Studio 2022
  • .NET 8 SDK (or the version specified in the .csproj file)
  • Windows 10 SDK (version 10.0.19041.0 or newer), included with the ".NET desktop development" workload in the Visual Studio Installer.

Steps

  1. Clone the repository:

    git clone https://github.com/rafarrw/Bluetooth-Command-Line-Switcher-for-Windows.git
    cd Bluetooth-Command-Line-Switcher-for-Windows
  2. Open the solution file (.sln) in Visual Studio.

  3. Publish the project:

    • In the Solution Explorer, right-click on the BluetoothSwitcher project and select Publish.
    • Choose Folder as the publishing target and click Next.
    • Choose a specific location (or leave the default) and click Finish. This will create a publish profile.
  4. Configure the publish profile:

    • After the profile is created, you will see a summary. Click the "Show all settings" link.
    • Set the following options:
      • Deployment mode: Self-contained (This includes the .NET runtime so it can run anywhere).
      • Target runtime: win-x64
      • Check the box for "Produce single file".
    • Click Save.
  5. Publish:

    • Click the Publish button in the top right.
  6. Locate the executable:

    • Visual Studio will compile the project and place the final, single BluetoothSwitcher.exe file in the publish folder (e.g., bin\Release\net8.0-windows10.0.19041.0\win-x64\publish\). You can take this single file and run it on any modern 64-bit Windows machine.

License

This project is licensed under the MIT License. See the LICENSE file for more details.

About

No description, website, or topics provided.

Resources

Stars

3 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages