JIYIK CN >

Current Location:Home > Learning > OPERATING SYSTEM >

Transferring files to Raspberry Pi using batch script

Author:JIYIK Last Updated:2025/03/21 Views:

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

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

It also supports other network protocols, such as SCP and some raw socket connections. It can also connect to serial ports.

This third-party software is primarily written for the Windows operating system, but has also been ported to other operating systems.

This article will use the PSCP tool, PuTTY Secure Copy Client, which is used to transfer data securely between computers using an SSH connection.

We will use another tool called Plink, which is a command line interface for PuTTY backend. It can be used for SSH tunneling.

It is also a tool similar to UNIX ssh, mainly used for automation operations.


Transferring files to Raspberry Pi using batch script

  • First, you must install PuTTY on your Windows system.
  • After that, use PSCP to transfer the file using the following syntax.
    pscp [YOUR OPTIONS] [USER@]HOST:source target
    pscp [YOUR OPTIONS] source [YOUR SOURCE...] [USER@]HOST:target
    pscp [YOUR OPTIONS] -ls [USER@]HOSTt:filespec
    
  • The available options for this command are shared below.
   
-V This option will print version information.
-pgpfp This option prints the PGP key fingerprint.
-p This option preserves file attributes.
-q This option tells us not to display statistics.
-r This option is used to copy directories recursively.
-v This option is used to display detailed messages.
-load sessname This option will load the settings from a saved session.
-P port This option will connect to the specified port.
-l user This option will connect using the specified username.
-pw passw This option will log in using the specified password.
-1 -2 This option will force the use of a specific version of the SSH protocol.
-4 -6 This option will force the use of either IPv4 or IPv6.
-C This option enables compression.
-i key This option sets the private key file used for authentication.
-noagent This option will disable Pageant.
-agent This option will enable Pageant.
-batch This option disables all interactive prompts.
-unsafe This option allows you to use server-side wildcards, but it is insecure.
-sftp This option will force the use of the SFTP protocol.
-scp This option will force the use of the SCP protocol.
  • Finally, use Plink to execute the script on the Raspberry Pi.

For reprinting, please send an email to 1244347461@qq.com for approval. After obtaining the author's consent, kindly include the source as a link.

Article URL:

Related Articles

Reading file into variable in batch script

Publish Date:2025/03/22 Views:121 Category:OPERATING SYSTEM

Sometimes, we need to put the entire contents of a file into a variable for various purposes, such as finding specific data from a file, replacing a specific part of a file, etc. In Batch, it is very easy to put the entire file contents in

Declaring variables in batch script

Publish Date:2025/03/22 Views:66 Category:OPERATING SYSTEM

This article will demonstrate how to declare and define variables in a batch script. Declaring variables in batch script In Batch, you do not need to use any additional keywords to declare integer, float, double, or string type variables. T

Replace text in a file in batch script

Publish Date:2025/03/21 Views:105 Category:OPERATING SYSTEM

In this article, we will look at some ways to replace text in a file. We will look at two different ways. Our first approach consists only of a batch script to perform the task, while the second approach provides a solution through Windows

Running batch scripts in C#

Publish Date:2025/03/21 Views:139 Category:OPERATING SYSTEM

In this article, we will see how to write a C# program that can run a batch file from a directory. Running batch scripts in C# In C#, when we want to execute a batch file, it acts as a process. You can follow the sample code below to run a

Extract or unzip files in batch script

Publish Date:2025/03/21 Views:122 Category:OPERATING SYSTEM

In this article, we will see how to create a batch script to extract files from a zip file. Create a batch script to unzip the files We can extract or decompress files using batch scripts which need to contain the destination directory wher

Renaming part of a file name in a batch script

Publish Date:2025/03/21 Views:124 Category:OPERATING SYSTEM

Sometimes we need to rename a series of files in a specific order. Most project files contain this sequence, and we can easily do this in a batch script using a simple one-line command. This short article will show us how to change a specif

Run batch scripts using Task Scheduler

Publish Date:2025/03/21 Views:153 Category:OPERATING SYSTEM

This article will show you how to use Task Scheduler to run a batch file. Run batch scripts using Task Scheduler With Task Scheduler, you can automate tasks to run automatically at specific times. It only takes a few steps and you don't nee

Scan to Read All Tech Tutorials

Social Media
  • https://www.github.com/onmpw
  • qq:1244347461

Recommended

Tags

Scan the Code
Easier Access Tutorial