What is WinSCP?
WinSCP is a free and open source graphical user interface for managing files and directories on remote computer systems via SSH. The program supports SFTP, FTP, FTPS/TLS or HTTP protocols over port 22. It also provides support for SCP which allows file transfers between two machines where the one running WinSCP has read-only access to the other’s filesystems..
The “generate script from winscp” is a command-line tool that allows users to generate scripts for WinSCP. The tool can be used in conjunction with the GUI, or on its own.
If you’re using Windows and need to transfer files securely to and from an SSH host, WinSCP could be a good choice. WinSCP is a free and open-source Windows program that lets you handle files and directories on remote sites via SFTP, FTP, Amazon S3, and SCP.
If you’re interested in learning more about WinSCP, check out the ATA Ultimate Guide! In this post, you’ll learn how to install WinSCP and how to use it to transfer files to and from remote sites.
Let’s get started!
Prerequisites
If you want to follow along with the demonstrations in this tutorial side by side, make sure you have the following:
- A computer with Windows XP or later — The operating system used in this lesson is Windows 10 Enterprise.
- An SSH host on the other side of the world — This lesson will be performed on a PC running Ubuntu 18.04.5 LTS.
- Putty – If you want to learn how to use Putty to open WinSCP sessions.
How to Setup WinSCP
You must first download and install WinSCP before you can start manipulating files and folders like an expert. Let’s get this over with.
Navigate to the WinSCP official download website and download the most recent version of WinSCP using your preferred web browser. v5.17.10 will be used in this lesson.
Although the default WinSCP package is in English, you may download other language packages.
Run the installer after downloading it and follow the instructions, accepting all of the settings. The course will use the Commander style of interface on the Initial User Settings page. This interface offers more functionality than the Explorer interface, which has been pared down.
Selecting a User Interface
Commander and Explorer are the two user interfaces available in WinSCP. These interfaces allow you to use WinSCP in the traditional way (Commander style) or to make WinSCP look like Windows File Explorer.
The way WinSCP presents file structures is the major difference between the two interfaces. The differences are shown below.
Interface for WinSCP Commander
Interface of the WinSCP Explorer
You may switch between interfaces at any moment. To alter them, follow these steps:
1. Select Preferences from the Options menu in WinSCP.
Using the Preferences menu in WinSCP
2. Go to the Environment category and choose Interface. Here you can see where you may choose between the two interfaces. Click OK after you’ve decided on an interface.
Changing the appearance of the WinSCP interface
3. Restart WinSCP after closing it. When you restart WinSCP, you’ll find that the interface has changed to the intended one.
The default Commander interface will be used in this course.
Getting in Touch with a Remote Host
In WinSCP, you could spend all day working with local directories and files, but that’s not the objective. You’re managing remote files using WinSCP! Let’s get started connecting to distant computers!
There are many methods to connect (and preserve connections) to remote hosts with WinSCP. To begin, let’s concentrate on making a basic one-time connection. To do so, select Session from the menu bar. A new Login box will popup, as illustrated below.
You may use this window to connect to distant hosts quickly or store connections to hosts known as sites, which you’ll learn about later.
If you don’t have any sites set up, the left-hand pane will default to the New Site option. You do not need to be concerned about sites at this time.
Window for logging into WinSCP
WinSCP needs a few parameters to connect to a remote host:
- The mechanism of connecting to the remote host is known as the file protocol. To connect to remote hosts, WinSCP supports five distinct protocols.
- SFTP (SSH File Transfer Protocol) is a network protocol for Transferring Documents and managing all file actions across a secure network. Because it encrypts all data and waits for packet transmission and confirmations, it is the slowest in general.
- FTP, or File Transfer Protocol, is similar to SFTP in that it enables you to either authenticate yourself using the SSL/TLS protocol or connect anonymously if the distant server permits it. FTP is a quicker protocol than SFTP.
- SCP, or Secure Copy Protocol, is a protocol for securely copying files from one system to another using SSH. SCP is only available on Unix-like systems. The files are copied at a quicker rate than SFTP.
- WebDAV, or Web Distributed Authoring and Versioning, is a Hypertext Transfer Protocol (HTTP) extension that enables users to edit and manage documents and files that are hosted on web servers.
- S3, or Amazon Simple Storage Service, is an Amazon Online Services web service. It’s a storage service that employs a variety of protocols, including REST, SOAP, and others, but WinSCP works with the S3 service using REST.
- The hostname or IP address of the remote host.
- The TCP port number on which the remote host’s File protocol is listening. The default TCP port 22 is used by most SSH implementations.
- User name – This is the username that will be used to connect to the remote host.
- Password – The username’s password to login with.
To connect to the remote host, click the Login button after you’ve finished filling in all of the connection details.
When WinSCP is connected, it will display the remote host’s home directory on the right side, as well as the connected username and host for the current session, as seen below.
WinSCP session that is connected
You may now start traversing directories for both local and remote sessions, as well as manipulating files across them.
Getting Around Directories
When WinSCP establishes a remote connection with a host, it places you in the home directory of the user account with whom you connected. It’s likely that this isn’t the directory you want to be in. When this occurs, you’ll have to start looking for the directory and/or files you want to work with.
Creating a Parent Directory
In both the local and remote session windows, WinSCP shows directories as folders, much like Windows Explorer. Like you’re accustomed to, you can navigate around and dive down into directories. However, unlike Windows Explorer, WinSCP lacks an up arrow for navigating into parent directories.
A file system organizes directories into parent and child directories in a hierarchical structure. Double-click the two dots (..) if you’re in a child directory, as seen below. As you can see, WinSCP switches the directory to the parent of the current directory.
To go to a parent directory, use the navigation bar at the top of the page.
Specific Directory Paths Opened
Although WinSCP may be used to search file systems for directories, it can also be used to open particular directory paths if you know them ahead of time.
If you know a specific directory path you’d like to open, click on the Local menu —> Go To —> Open Directory/Bookmark, as shown below. WinSCP will then open a window titled Open directory which prompts you with a Browse button allowing you to type in a path or browse to one.
Creating a specific route
In the menu bar, you’ll see a Local and Remote option. Both of these alternatives have identical actions. The Local menu controls the local computer, while the Distant menu controls the remote computer.
Directories for Bookmarking
If you have certain directories you access often, WinSCP allows you to bookmark directories. Directories for Bookmarking create a common list of directories you can easily come back to later.
Bookmarks in a Directory
To bookmark folders in WinSCP, follow these steps:
1. In the directory pane, choose the directory you want to bookmark.
2. Click on the Local menu —> Add Path to Bookmarks. This action will bring up a confirmation box, as you can see below.
Take note of the option that says “Add to shared bookmarks.” Session and shared bookmarks are available in WinSCP. Session bookmarks are only valid for that particular session. Your bookmarks are lost when you disconnect from the session. Shared bookmarks, on the other hand, are saved and must be removed manually.
In WinSCP, you may save routes as bookmarks.
3. To confirm the bookmark, click OK.
Getting Access to Bookmarked Directories
You can rapidly access to those bookmarked folders after you’ve generated one or more bookmarks. To do so, follow these steps:
1. Navigate to the Local menu —> Go To —> Open Directory/Bookmark.
Using WinSCP to open a bookmark
2. Go to the bookmarked directory and choose it, as shown below.
The entry C:UsersPublic appears in the Shared bookmarks tabs in the image below. This bookmark exists because the Add to Shared Bookmarks option was selected when the bookmark was saved.
Bookmarked Directory is selected.
3. To open the bookmark, click OK.
WinSCP will then transport you straight to the directory when you click OK.
Getting Around in Files
Because you’ll be working with files a lot with WinSCP, it’s critical that you understand the basics. Apart from browsing the filesystem, WinSCP includes a few hidden functions that you may not be aware of.
Locating Documents
You don’t have to scroll around until you discover the files you want to transfer to/from a remote session in a directory with hundreds or thousands of them. Instead, you may utilize WinSCP’s filtering capabilities to zero in on just what you need.
To filter out all of the files in the file windows that you aren’t searching for, do the following:
1. Go to the Filter menu in the Local (or Remote) menus. This operation will open the Filter dialog box, allowing you to choose a File mask.
2. Provide a file mask depending on the needed syntax in the File mask box.
Filtering to Find a File
3. Select the Edit button to view a graphical interface for creating a file mask filter.
Changing the File Mask
4. When you click OK, the file pane will only display files that match your file mask.
Organizing Files
You may arrange files in WinSCP’s local or remote file panes based on a variety of parameters, including name, extension, date updated, and more.
To sort files, click on the Local (or Remote) menu —> Sort and choose the attribute you’d like to sort files on.
Organizing Files
Bringing Up Files That Have Been Hidden
Are you unable to access all of the files on the local or distant computer that you are aware of? They might be tucked away. To see hidden files in WinSCP, do the following:
Click on Options —> Preferences. Inside of the Preferences window, click on the Panels section and select Show files that have been hidden (Ctrl-Alt-H).
To avoid clicking, WinSCP includes a number of keyboard shortcuts.
Once you’ve told WinSCP to display hidden files, you’ll be able to handle them as you would expect.
Show files that have been hidden
Choosing Files
You must first choose whatever files you want to transfer before you can transfer them. If you’re only transferring a few files, just go to the folders you require, click a file, or pick several files while holding Ctrl or Shift.
You can have a lot of distinct files to transfer that all satisfy different criteria. Take a look at the Mark menu in such instance. “Marking” in WinSCP enables you to establish filters for files in a specified directory, which subsequently selects all of them.
For instance, suppose you have a big directory of files open and just want to transfer the files with the ps1 extension. To do so, follow these steps:
1. Go to the Mark menu and choose Select Files… from the drop-down menu, as shown below.
Select Files is a menu option.
2. Then, for each file, indicate the file mask you want to match.
To select files, use a WinSCP file mask.
You’ll see that the Select Files and Filter features both define a file mask in the same way.
If you need to apply more advanced filters, click the Edit button, which will display additional options to apply to your filter.
Creating a WinSCP selection file mask filter that is more sophisticated
To confirm the selection filter, click OK. The current directory will now contain all of the subdirectories and filters that match the selection filter.
Transferring Documents
So you’ve tweaked WinSCP to your satisfaction, established a remote connection, and figured out how to explore the local and remote filesystems. It’s time to put WinSCP to work and start transferring files!
You can transfer (and even sync) local and remote files with WinSCP in a variety of methods. Let’s go through each approach one by one, from the most basic to the most sophisticated.
Dropping and Dragging
Whenever you’re connected to a remote host, one of the easiest ways to transfer files is by Dropping and Dragging one or more files to and from local and remote windows.
To copy files using drag and drop, go to the local and remote folders you want to transfer files to/from, and then click and drag one or more directories or files over.
You may also use the keyboard to pick things by switching between them with the arrow keys, then selecting them with the spacebar or the Insert key.
Copying files with Dropping and Dragging
Pasting and Copying
If Dropping and Dragging isn’t your thing, you can also copy and paste files to/from remote hosts. To do so, select one or more files, right click them and select Copy.
duplicating a file
Navigate to the directory where you want to copy the files you just selected in the other window, right-click on the window, and choose Paste.
Invoking a High-Level Transfer
Dropping and Dragging or Pasting and Copying files does transfer files with WinSCP but your options are limited. By default, for example, WinSCP uses the binary transfer mode. Perhaps you’d rather use text mode? You can set many different options to perform a file transfer in WinSCP.
Select the files you want to transfer and press the F5 key to start an advanced transfer. When you press this key, an Upload box will appear, allowing you to choose from a variety of transfer choices.
You have a few alternatives at this stage. By clicking OK, you may either do a regular transfer or alter the file mask to only transfer certain files.
Invoking a High-Level Transfer
However, if you select the Transfer Settings button, you’ll see a lot more choices that this article will not cover. You may alter the transfer mode, adjust rights on files after they’ve been uploaded, keep the local timestamp, and more in the Transfer Settings panel.
Options for transferring settings
Transfer Queues and Background Transfers
If you’re transferring a file here and there, typically, you’ll be Transferring Documents via WinSCP in the foreground. You’ll transfer the files, watch the progress and move on. But, if you have many different files that may take many minutes or even hours or have an automation routine, you can also transfer files in the background and use the WinSCP queue.
You may speed up file transfers by transferring in parallel using background transfers, or just free up your WinSCP terminal to do other things while files are uploading.
Invoke an advanced transfer as explained in the last section to transfer files in the background. You’ll find a Transfer in the Background option in the Transfer Settings dialog box (add to transfer queue).
Transferring files in the background
While you use the Transfer in Background option when completing a transfer, WinSCP adds it to the transfer queue right away, as seen below. WinSCP keeps track of all background transfers in the transfer queue.
Once a transfer is in the transfer queue, you may use WinSCP to do other things, such as start another transfer! The transfer queue is a useful tool for doing several transfers at once and queueing them all up instead of waiting for each one to finish.
Examining the Waiting List
WinSCP establishes a new connection to the server for each background transfer, using the same session parameters as when the session was created. These new connections are saved and utilised in the background for future transfers.
The transfer queue will only try to complete two transfers at a time by default. This behavior may be changed by going to the Preferences menu and adjusting the Maximal number of simultaneous transfers under the Background section, as shown below.
Waiting for a WinSCP transfer
You may adjust the behavior of the transfer queue in the Background transfers Preferences menu.
performances in the background
Taking Care of WinSCP Sites
Although WinSCP allows you to connect to remote hosts rapidly, it does not preserve such connections by default. It’s likely that you have a lot of different hosts in your environment, and remembering the hostname and credentials will get tedious.
Assume you have a remote host with SSH enabled that you often connect to. You’d want to store that connection so you can immediately connect when you browse to that host. Saved connections, also known as sites in WinSCP, allow you to store connections to remote hosts so that you can just navigate to them and connect.
Creating Sites in WinSCP
To create a WinSCP site and store your session for later use, follow these steps:
1. Click the Session menu as mentioned in the Getting in Touch with a Remote Host section and provide all of the necessary connection information.
2. Select the Save option.
Creating a backup of a WinSCP site
3. Next, give the stored connection a Site name and an optional folder, then click OK to confirm.
After clicking the save button, save the session as a site.
You don’t need a folder if you just have a few connections to preserve, but if you’re using WinSCP to connect to dozens or even hundreds of different hosts, organizing connections into folders is a handy method to discover them later.
Your new site will now appear in the Login box. This time, instead of being editable, the session attributes are all greyed off. The properties have now been stored to a website.
A new website has been built.
4. Finally, to test the site’s connection, click Login. The connection to a new site starts once you click Login.
Connecting to the web page
5. Choose Yes to save the server host keys in your system cache, allowing WinSCP to trust the remote host. Click the Yes button if you believe the remote host’s vital facts.
The server host’s keys do not need to be saved. If you choose No, you will be able to connect to the remote host, but this prompt will appear every time.
How to Connect to a Host Using an SSH Key in Visual Studio Code
Prompt for a Cache Host Key
Once you’ve created at least one site, you now find them by clicking on the Session menu —> Sites and clicking on the site you’d like to connect to, as shown below.
Getting to the WinSCP website
WinSCP Sites: Editing, Renaming, and Deleting
After you’ve built a site, you may customize it as you like. If you need to modify the attributes of an existing site, such as the hostname or login, you may do it using WinSCP.
1. Select the Session menu option to bring up the Login box once again. In the Login page, you’ll see all of your saved sites.
You can alternatively bring up the Login window/Site Manager by clicking on the Session menu —> Sites —> Site Manager.
2. Locate the site you want to change, right-click it, and choose Edit from the drop-down menu, as shown below. Options that were previously greyed out will now be editable.
Click the Delete or Rename menu option to rename or delete a site. By selecting Clone to New Site, you may make duplicates of sites that may have the same login.
Making Changes to the Website
3. When you’ve finished editing any properties that need to be changed, click the Save button, as shown below.
After you’ve finished changing the site, save it.
In the Site Manager, you’ll see an Advanced button. WinSCP keeps track of sites in files. If you need to change a site’s settings in the files itself, you may do so here. You can alter raw settings and sophisticated settings that you might not require very frequently.
All Sites are being backed up and restored.
Perhaps you’ve built a slew of websites and now need a new PC. So, what’s next? There isn’t a cloud service that WinSCP syncs to. Those sites must be transferred manually. WinSCP provides a feature called settings that allows you to backup and restore all of your sites in this way.
To export all of your saved sites, go to:
Open the Site Manager and choose Tools from the drop-down menu. When you click Export/Backup Configuration, you’ll be prompted to save all of your sites in an INI file at your preferred place.
Click Import/Restore Configuration to import a previously stored configuration. All current sessions will be overwritten if you import a configuration!
Sites Imported from Other Tools
There’s no need to reinvent the wheel if you’re already using the popular Putty SSH client and have stored sessions there. All of those sessions may be imported immediately into WinSCP.
To import sites from other programs such as Putty, follow these steps:
1. Go to the Session Manager and open it.
2. In the left site menu, right-click anywhere and choose Import Sites. Putty, FileZilla, and known hosts are just a few of the supported sources for site import from in WinSCP’s Import sites box.
supported sources for site import
3. Choose a source from which to import data. In the box below, WinSCP should display each site that it is capable of importing.
Select the sessions you want to import one by one, or click the Un/check all box and then OK to import them all.
Sites that have been imported
Logging of Sessions
If you need to go back to a command issued in a remote session, you’re going to need some way to save the history. WinSCP provides a Logging of Sessions feature that does just that. Open the Preferences menu item and click on the Logging option, you’ll see a way to enable Logging of Sessions.
Don’t be concerned. Unless you choose the Log passwords and other sensitive information option, passwords are never logged in any log.
WinSCP Logging of Sessions options
To enable Logging of Sessions, check the Enable Logging of Sessions on level checkbox and provide a logging level.
Logging of Sessions Options
WinSCP reports events in the session log in an unstructured manner that changes depending on the protocol being used. The session log is usually useful for troubleshooting.
For the session log, you may set a few different levels of logging.
- Reduced — The logging level with the least granularity.
- Normal — This logging level is the default and is usually sufficient for most troubleshooting or auditing.
- To become highly granular, use Debug 1/Debug 2.
WinSCP will store the log file to the Log Path. You may use dynamic criteria to have WinSCP save log files based on date/time characteristics and other factors.
To construct the appropriate log file name, you may use a mix of patterns, such as:
- Year –!YYYYYYYYYYYYYY
- !M (Month)
- Day – !D
- !T –!T –!T –!T
- [email protected] is the hostname.
- !S is the name of the session.
- Identifier of the process – P
- !! (exclamation mark)
Limit log sizes by activating the Rotate log files after reaching checkbox and selecting the maximum size a log file may develop. Bytes are represented by K, M, and G in this dropdown. If a log file becomes too huge, WinSCP will make a duplicate with the extension. 1, 2, and so forth.
If you activate logging while already in a session, logging will begin immediately. In the log file, WinSCP does not keep track of all prior sessions.
The Log of XML
In the Session Log area, you can choose what to record and how to record it. The session log is a text file that stores logs in an unstructured format. Enable XML logging to file should be checked if you require a more organized method for future processing.
WinSCP will create a structured XML file if you enable XML logging. This format contains less data than the session log, but it may still be utilized for scripting.
Organizing Workplaces
Perhaps you work with a collection of websites that you keep open all day. In most cases, you’ll need to connect to these hosts in some manner. Rather of accessing each site individually every day, you may put them all in a workspace and save them as one.
Conserving Workspace
Perhaps you have hundreds of websites open and want to return to them all at once. A workspace must be created/saved. To do so, go to the Session menu and choose Save Workspace from the drop-down menu. After that, WinSCP will ask you where you want to store the workspace file.
Conserving Workspace
Give the workspace a name and choose whether or not to store any passwords in the Save workspace as dialog box.
You’ll also see the option to create a desktop shortcut. WinSCP will create a desktop shortcut with the following target if you choose this option. This target will create the My Workspace workspace. This desktop shortcut is useful because if you don’t have it, you’ll have to utilize the Session Manager to access the workspace, as discussed in the following section.
Program Files (C:Program Files) (x86) “My percent 20Workspace” /Desktop WinSCPWinSCP.exe
You’ll also notice an option to enable automatic workspace saving. This option is convenient since it eliminates the need to manually save your workspace as seen above.
This workspace is automatically saved.
Opening and Closing Workspaces
After you’ve stored a workspace anywhere on your computer, you’ll need to open it. To open/restore a workspace, follow these steps:
Open Site Manager, locate the workspace in the left pane, right-click it, and choose Login from the menu.
When the Login window appears, the workspace stored when WinSCP was last closed is automatically chosen.
Getting a workstation back in order
SSH Commands Executed on Remote Hosts
You can easily perform numerous short tasks on a connected host using features like the built-in command-line box, Commands that are unique to you, and even Putty.
The WinSCP Command Line is a set of commands that you may use to connect to
If you need to run a simple SSH command without having to open a separate SSH client, you can do so by using The WinSCP Command Line is a set of commands that you may use to connect to feature. To access the feature, click on the Options menu and select Command Line, as shown below. You’ll see a Command box appear at the bottom.
Using the WinSCP command line, run the ifconfig command to locate an IP address.
Type whatever terminal command you want into the Command box, and WinSCP will execute it on the remote computer. For example, enter ifconfig to find out the IP address of the remote host, as seen below.
Do not run commands that require user input. The WinSCP Command Line is a set of commands that you may use to connect to doesn’t support interactive commands.
Using the ifconfig command to determine the remote host’s IP address
Commands that are unique to you
Let’s say you find yourself running a particular command over and over on a remote host or maybe you’d like to run a particular command against all files in the remote file pane. If so, WinSCP’s Commands that are unique to you feature is for you.
Commands that are unique to you are pre-configured commands that can contain variables representing environmental attributes like the host you’re connected to, the user you’re connected with, and more. Commands that are unique to you templatize common actions.
Running a custom command, such as cat “!” for example, executes the cat command on all specified files in the remote panel. Alternatively, you may create a sophisticated SSH command that you can store and perform later.
To set up and run Commands that are unique to you, click on the Commands menu and then on Static Commands that are unique to you. This menu is where you will see how to enter ad-hoc Commands that are unique to you or even save some of your own.
To demonstrate, press the Enter key. A window called Custom Command will pop up.
Getting to the custom command
To observe how WinSCP interprets the!S placeholder with the session URL, enter echo!S in the Custom Command box and click OK.
You can find all placeholders on the WinSCP Commands that are unique to you documentation page.
Command windows that you create yourself
Because the Show results in terminal option was chosen, WinSCP displayed the same Console window as when the command line feature was utilized. You can see it in the image below! The session URL is sftp:/automate:automate, which was translated from S.
this remote connection’s URL wit
Putting Putty to Work
You don’t need to utilize WinSCP for any further tasks after you’ve formed a session. That session may be sent to the popular Putty SSH client.
In Putty, start a WinSCP session. by clicking on the Commands menu and selecting Open in Putty if you’re presently in a WinSCP session. Putty will open and connect to the remote host that you’re connected to in WinSCP.
Unless you provide the access key id and secret key for the specific system, Putty will demand for a password by default.
In Putty, start a WinSCP session.
Organizing
WinSCP saves a variety of data in the file system and the registry on your computer. If you’re using a shared computer, you might want to clear everything out. To do so, follow these steps:
1. Go to the Site Manager and click on it.
2. Select the Tools option.
3. Select Clean Up from the drop-down menu. The Cleanup application data box will appear, as seen below.
4. Select Random seed file, which includes randomly produced data on WinSCP launch to seed its encryption random number generator, and General configuration, which is all workspace and site-related settings saved in the registry.
Keeping up to date and obtaining assistance
Finally, it’s critical to maintain WinSCP up to date in order to benefit from the most recent bug fixes and improvements. If you believe your version is out of current, go to the Help menu and choose Check for Updates from the drop-down menu. If a new version is available, WinSCP will notify you and encourage you to install it.
The Help menu also contains WinSCP documentation, as well as an option to contribute to the open-source project if you so want.
Conclusion
WinSCP is a useful and free utility for transferring files and running remote commands on computers. You can’t match the pricing with its built-in sites and many methods to pick and transmit data.
How do you intend to utilize WinSCP now that you’ve mastered it?
The “winscp download” is a graphical user interface for the popular file transfer tool. It’s easy to use, and allows you to transfer files between your computer and other devices like a USB drive or over Wi-Fi.
Related Tags
- winscp put command
- winscp documentation
- winscp command line
- winscp automate file transfer
- winscp option confirm off example