Transferring files to Raspberry Pi using batch script
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.
Related Articles
Renaming part of a file name in a batch script
Publish Date:2025/03/21 Views:122 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:152 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
Prompt user for input and use the result in a batch script
Publish Date:2025/03/21 Views:110 Category:OPERATING SYSTEM
-
This article will show you how to use a batch script to get user input and use the results in another command. Prompt user for input and use the result in a batch script The general format of code that accepts user input is shown below. set
Mapping a network drive in a batch script
Publish Date:2025/03/21 Views:69 Category:OPERATING SYSTEM
-
This article will discuss how to map a network drive in a batch script. Mapping a network drive in a batch script For this purpose, we will see three formats of the same command. However, the general format of the command is: net use P: "\\
Copy files using batch script
Publish Date:2025/03/21 Views:91 Category:OPERATING SYSTEM
-
Batch scripts are scripts built specifically for the Windows command line to perform a variety of tasks and execute user-directed sequences of commands. Batch scripts make it easy to use Windows PowerShell. This article will explain how to
Downloading files from URL in batch script
Publish Date:2025/03/21 Views:63 Category:OPERATING SYSTEM
-
Today we have several download managers to download necessary files from the Internet. In addition, there is a download manager integrated into every web browser. But you can create a batch script that can also perform a similar task of dow
Run .exe file from command prompt using batch script
Publish Date:2025/03/20 Views:77 Category:OPERATING SYSTEM
-
This article will show you how to use a batch (.bat) script to run a .exe type file. You can use two different commands to achieve this. Let’s discuss each method in the following sections. Run .exe file from command prompt using title an
Deleting files older than N days using batch script
Publish Date:2025/03/20 Views:57 Category:OPERATING SYSTEM
-
In this article, we will use a batch script to delete files older than N days. Deleting files older than N days using batch script The general format of the code to perform this task is shown below. FORFILES /p "D:\DIRECTORY" /S /M *.* /D -
Deleting files using batch script
Publish Date:2025/03/20 Views:178 Category:OPERATING SYSTEM
-
This article will demonstrate how to delete files using a batch script. Deleting files using batch script Generally, we can easily delete files by clicking on delete or pressing the delete button on the keyboard. But in Batch, we have to fo