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

Lui*_*ldi 24 windows cmd.exe

我正在使用命令提示符,我想将文件发送到我的手机。是否可以从命令提示符通过蓝牙发送文件?

Dav*_*ill 28

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

对的,这是可能的。有关 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.
Run Code Online (Sandbox Code Playgroud)

样品:

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

    btobex -n"Nokia 6300" picture.jpg
    
    Run Code Online (Sandbox Code Playgroud)
  2. 将当前文件夹中的所有文本文件发送到具有已知地址的设备:

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

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

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

来源btobex


Ubuntu

使用蓝牙发送

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

“12:34:56:78:9A:BC”是设备的蓝牙设备地址(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 脚本


免责声明

我与蓝牙命令行工具没有任何关联。

  • 为什么 Ubuntu 解决方案不同于 Linux 解决方案?obexftp 不能在 Ubuntu 中工作,也不能在非 Ubuntu Linux 发行版上使用 bluetooth-sendto 吗? (3认同)