envia um arquivo via bluetooth a partir do prompt de comando

21

Estou trabalhando com o prompt de comando e gostaria de enviar um arquivo para o meu telefone. É possível enviar um arquivo via bluetooth a partir do prompt de comando?

    
por Luigi Grimaldi 23.05.2017 / 12:26

1 resposta

26

É possível enviar um arquivo via bluetooth a partir do prompt de comando?

Sim, é possível. Veja abaixo as soluções para Windows, Ubuntu e Linux.

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

Use o 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

Ferramentas de linha de comando do Bluetooth Bluetooth

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.

Fonte 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 Transferência de arquivos Bluetooth no shell script , responda por 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

Fonte Utilitário bluetooth de baixo nível , respondido por slm

Veja também script do Linux para operação do Bluetooth

Aviso de isenção

Não sou afiliado de nenhuma forma às Ferramentas de linha de comando Bluetooth .

    
por 23.05.2017 / 12:41