This is an old revision of the document!
Editing/Opening Files
WinSCP allows you to edit/open remote file using editor or associated application on local machine. To do so it needs to download the remote file to temporary directory first. Then it opens the file in your preferred editor or associated application. Once you change the file, WinSCP uploads it back. With Commander interface you can even edit/open local files, but most of this chapter covers editing remote files only.
To edit file selected in panel go to File(s) > Edit. The command by default opens the file in an internal editor. You can make the command open the file in any external editor in preferences. From submenu File(s) > Edit (alternative) you can open the file in any of configured editors. By default the file is also opened in editor when double-clicked1 (this can be changed in preferences).
Advertisement
You can create new empty file using command File(s) > New > File. The command asks for name of the new file and then opens your default editor.
To open file in an associated application use File(s) > Open. This way you do not need to configure external editor for each file type. However you will not be able to set an additional options.
Editing and opening of files can be restricted by system administrator.
Especially when the files are opened in an external editor, user can easily change two files at once. For this reason WinSCP must upload the files back using background transfer/queue to allow several uploads at once.
External Editors
For basic editing WinSCP offers a simple integrated text editor. For advanced editing you will probably want to configure your favourite editor.
Some external editors can open multiple files in one process. Usually such editors have some kind of tabbed interface, but it is also case of new versions of Microsoft Word (2000 and later).
If such an editor is already running and WinSCP runs a second instance to open new file, the second instance just notifies the first to open the new file and exits immediately. Hence WinSCP expects that the file was closed as well and tries to delete the temporary file.
Advertisement
To allow WinSCP to use this kind of editor, you need to configure it as an external editor and enable preference option External editor opens multiple files in one window (process)2. Then WinSCP will not treat the file as closed when the editor launched to open it is closed.3 Note that setting only affects the “edit” operation. So you may want to make sure that editing is default operation for double-click.
If you choose to edit the same file again during the same session, WinSCP will download it to the same temporary directory as before, allowing the external editor to reload the file content in case it has it still opened (if the editor can detect the change).
If you want to both keep the standard WinSCP behaviour and use your preferred editor, you should check if your editor offers you option to open separate instance for each edited file. Some editors have such option:
- UltraEdit: Advanced > Configuration > General > General Application Items > Allow multiple instances
- PSPad: Settings > Program Settings > System Integration > Only One Program Instance
- Crimson Editor: Tools > Preferences > General > Allow Multiple Instances
- TextPad: Configure > Preferences > Allow Multiple Instances to Run
- Notepad++: Use command-line switch
-multiInst
Editing Binary Files
The internal editor supports only Windows-format text files. Thus the text transfer mode is forced when transferring remote file to/from the internal editor.
If you want to edit binary files you need to use external editor that supports binary files and uncheck preference option Force text transfer mode for files edited in external editor. The configured transfer mode will then be used even for transfers to/from external editor. Note that if you have configured binary transfer mode, your external editor must support server-side format of text files (Unix format usually), if you still want to edit them.
Transfer Settings when Editing Files
When remote file is downloaded to editor or uploaded from editor, default transfer settings or settings of active preset are used, with some exceptions:
- Filename modification option is forced to “No change”.
- Replacement of characters not valid on Windows is enabled (original filename is restored on upload).
- Exclude and include masks are ignored.
- Text transfer mode may be forced (see Editing Binary Files).
- Transfer resume support is disabled.
- If resolving of symbolic links is disabled or not possible, double-clicking file is always interpreted as attempt to enter it, just in case it is unresolved symbolic link to a directory.Back
- Note that WinSCP can heuristically detect that you need to enable the option External editor opens multiple files in one window (process) and offers you to do so.Back
- Drawback is that all the files ever edited by the current instance of WinSCP will be kept in temporary directory (until WinSCP is closed) and WinSCP will need to watch for changes of them all.Back
Advertisement