通过蓝牙从命令提示符发送文件


Answers:


26

是否可以从命令提示符通过蓝牙发送文件?

对的,这是可能的。有关Windows,Ubuntu和Linux解决方案,请参见下文。


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

使用btobex

蓝牙命令行工具是Microsoft Windows的一套命令行实用程序,可用于配置您的蓝牙适配器,发现远程蓝牙设备和服务,将文件传输到支持OBEX的设备。

可以将所有实用程序作为批处理脚本或其他自动后台进程的一部分来调用,也可以从Windows命令提示符下手动启动。

...

系统要求

  • Windows XP,Windows Vista,Windows 7,Windows 8或Windows 10(x86,x64)
  • Microsoft蓝牙堆栈兼容蓝牙适配器

蓝牙命令行工具

Btobex将文件发送到支持远程OBEX的设备(计算机,移动电话等)。

用法:

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.

样本:

  1. 将文件“ picture.jpg”从当前文件夹发送到名为“ Nokia 6300”的设备:

    btobex -n"Nokia 6300" picture.jpg
    
  2. 将所有文本文件从当前文件夹发送到具有已知地址的设备:

    btobex -b(11:11:22:22:33:33) *.txt
    
  3. 将其他程序的输出作为名为“ message.txt”的文件发送:

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

btobex维护ERRORLEVEL环境变量。零表示成功执行,任何其他值-错误。详细的错误描述会打印到标准错误输出中。

来源btobex


的Ubuntu

使用bluetooth-sendto

bluetooth-sendto --device=12:34:56:78:9A:BC filename 为我工作。

“ 12:34:56:78:9A:BC”是设备的蓝牙设备地址(bdaddr)。您可以使用获取bdaddr hcitool scan

Shell脚本中的蓝牙文件传输,由Elmicha回答


的Linux

使用obexftp

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

  • 允许一个人发送文件而无需指定远程设备端的引脚
  • 设备的OPush通道号从上面的sdptool获取

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

  • 允许将文件放入指定的BT设备
  • obexftp也可用于获取或列出BT设备上的文件
  • 还允许通过仅提供-b选项来识别附近的BT设备

低级蓝牙实用程序,由slm答复

另请参阅Linux脚本以了解蓝牙操作


免责声明

我不以任何方式隶属于Bluetooth命令行工具


3
为什么Ubuntu解决方案与Linux解决方案分开?obexftp在非Ubuntu发行版上不能在Ubuntu或bluetooth-sendto中工作吗?
Ruslan

您可能希望在答案的“ Ubuntu”部分中将注释包含在对Ubuntu答案的注释中。除此之外,很好的答案。相关- superuser.com/questions/1090009/...
强尼Henly

@Ruslan不知道。我什么都不用。
DavidPostill

您都不使用任何一个,但是这些占答案的2/3?您是否至少目睹了他们的工作,或者这只是传闻?
mickeyf_supports_Monica '17

1
@mickeyf一个来源是AskUbuntu上的公认答案,另一个来源是Unix&Linux mod上被高度评价的答案。我自己用过的Windows。
DavidPostill
By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.