send a file via bluetooth from the command prompt

Solution 1:

Is it possible to send a file via bluetooth from the command prompt?

Yes, it is possible. See below for Windows, Ubuntu and Linux solutions.


Windows XP, Windows Vista, Windows 7, Windows 8 or Windows 10 (x86, x64)

Use btobex.

Bluetooth command line tools are a suite of command line utilities for Microsoft Windows that can be used to configure your bluetooth adapter, discover remote bluetooth devices and services, transfer files to OBEX capable devices.

All utilities can be invoked as a part of a batch script or other automated background process or launched manually from the Windows command prompt.

...

System requirements

  • Windows XP, Windows Vista, Windows 7, Windows 8 or Windows 10 (x86, x64)
  • Microsoft bluetooth stack compatible Bluetooth adapter

Source Bluetooth Command Line Tools

Btobex sends files to remote OBEX capable devices (computers, mobile phones, etc).

usage:

btobex {-bBluetoothAddress | -nFriendlyName} [-cChannel] [-pPIN [-e]] 
         [-rRetries] [-fFileName] [file1 [file2 [...]]] 

    -b  Bluetooth address of target device in (XX:XX:XX:XX:XX:XX) format.  
    -n  Friendly name of target device.
    -c  RFCOMM channel (1-30). If specified, service lookup is not performed. 
    -p  PIN code for authenticating with remote device.
    -e  Use encrypted connection (only if PIN authentication is used)
    -r  Make specified number of attempts is case of error
    -f  Use this file name for the data from STDIN (standard input)      
    -h  Prints help screen.

samples:

  1. Send file "picture.jpg" from the current folder to the device named "Nokia 6300" :

    btobex -n"Nokia 6300" picture.jpg
    
  2. Send all text files from the current folder to the device with known address :

    btobex -b(11:11:22:22:33:33) *.txt
    
  3. Send output of other program as a file named "message.txt" :

    echo This is a test | btobex -b(11:11:22:22:33:33) -f"message.txt"
    

btobex maintains the ERRORLEVEL environment variable. Zero means successful execution, any other value - error. Detailed error description is printed to the standard error output.

Source btobex


Ubuntu

Use bluetooth-sendto.

bluetooth-sendto --device=12:34:56:78:9A:BC filename works for me.

"12:34:56:78:9A:BC" is the Bluetooth device address (bdaddr) of the device. You can get the bdaddr with hcitool scan.

Source Bluetooth file transfer in shell script, answer by elmicha


Linux

Use obexftp.

obexftp –nopath –noconn –uuid none –bluetooth <BTAddr> –channel <OPUSHChann elNo> –put <FileToPut>

  • Allows one to send file without specifying the pin on the remote device side
  • The OPush channel number for device is got from sdptool above

obexftp -b <BTAddr> -v -p <FileToPut>

  • Allows one to put a file onto the specified BT device
  • obexftp could also be used to get or list the files on the BT device
  • also allows one to identify a nearby BT device by just giving -b option

Source Low-level bluetooth utility, answer by slm

See also Linux script for Bluetooth operation


Disclaimer

I am not affiliated with Bluetooth Command Line Tools in any way.