22
5
I'm working with the command prompt and I would like to send a file to my phone. Is it possible to send a file via bluetooth from the command prompt?
22
5
I'm working with the command prompt and I would like to send a file to my phone. Is it possible to send a file via bluetooth from the command prompt?
26
Yes, it is possible. See below for Windows, Ubuntu and Linux solutions.
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:
Send file "picture.jpg" from the current folder to the device named "Nokia 6300" :
btobex -n"Nokia 6300" picture.jpg
Send all text files from the current folder to the device with known address :
btobex -b(11:11:22:22:33:33) *.txt
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
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
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
I am not affiliated with Bluetooth Command Line Tools in any way.
3Why is Ubuntu solution separate from Linux one? Won't obexftp work in Ubuntu or bluetooth-sendto on a non-Ubuntu Linux distribution? – Ruslan – 2017-05-23T18:09:00.937
You might want to include the note in the comments to the Ubuntu answer, in your answer's Ubuntu section. Other than that, great answer. Related - https://superuser.com/questions/1090009/ubuntu-sending-file-through-bluetooth
– Jonny Henly – 2017-05-23T19:05:25.107@Ruslan No idea. I don't use either of them. – DavidPostill – 2017-05-23T19:35:20.960
You don't use either, but these constitute 2/3rds of your answer? Have you at least witnessed them working, or is this just hearsay? – UnconditionallyReinstateMonica – 2017-05-23T21:58:36.793
1@mickeyf One source is an accepted answer on AskUbuntu, the other is a highly upvoted answer from a Unix & Linux mod. The Windows one I have used myself. – DavidPostill – 2017-05-23T22:03:19.487
Command prompt - Windows – Luigi Grimaldi – 2017-05-23T12:44:37.720
Tags updated... – DavidPostill – 2017-05-23T17:52:36.923