How to Transfer File to Raspberry Pi Using Batch Script

MD Aminul Islam Feb 02, 2024
How to Transfer File to Raspberry Pi Using Batch Script

This article will show a Batch command that transfers files to the Raspberry Pi environment from Windows and executes the file.

PuTTY is a third-party free tool that has a free implementation of Telnet and SSH for Windows and Unix platforms. It also features an xterm terminal emulator.

It also supports other networking protocols like SCP and some raw socket connections. It is also able to connect with a serial port.

This third-party software is mainly written for the Windows OS but is also ported to other operating systems.

This article will use a PSCP tool, a PuTTY secure copy client. This tool is mainly used for transferring between computers securely using an SSH connection.

There is another tool we will use named Plink, a command line interface to the back ends of the PuTTY. It can be used for SSH Tunneling.

It is also a tool similar to the UNIX ssh and is mostly used for automating operations.

Transfer File to Raspberry Pi Using Batch Script

  • First of all, you have to install PuTTY in your Windows system.
  • After that, use PSCP to transfer the file by following the below syntaxes.
    pscp [YOUR OPTIONS] [USER@]HOST:source target
    pscp [YOUR OPTIONS] source [YOUR SOURCE...] [USER@]HOST:target
    pscp [YOUR OPTIONS] -ls [USER@]HOSTt:filespec
    

    Below shared the available options for the command.

    -V This option will print the version information.
    -pgpfp This option will print PGP key fingerprints.
    -p This option will preserve file attributes.
    -q This option tells us not to show statistics.
    -r This option is for copying directories recursively.
    -v This option is for showing verbose messages.
    -load sessname This option will load settings from the saved session.
    -P port This option will connect to the specified port.
    -l user This option will connect with a specified username.
    -pw passw This option will log in with the specified password.
    -1 -2 This option will force the use of a particular version of the SSH protocol.
    -4 -6 This option will force the use of IPv4 or IPv6.
    -C This option will enable compression.
    -i key This option will set a private key file for authentication.
    -noagent This option will disable the use of Pageant.
    -agent This option will enable the use of Pageant.
    -batch This option will disable all interactive prompts.
    -unsafe This option allows you with server-side wildcards, but it’s unsafe.
    -sftp This option will force the use of the SFTP protocol.
    -scp This option will force the use of SCP protocol.
MD Aminul Islam avatar MD Aminul Islam avatar

Aminul Is an Expert Technical Writer and Full-Stack Developer. He has hands-on working experience on numerous Developer Platforms and SAAS startups. He is highly skilled in numerous Programming languages and Frameworks. He can write professional technical articles like Reviews, Programming, Documentation, SOP, User manual, Whitepaper, etc.

LinkedIn

Related Article - Batch File