Differences
This shows you the differences between the selected revisions of the page.
2017-01-11 | 2017-02-06 | ||
explicit anchor use (martin) | use ini=nul (martin) | ||
Line 37: | Line 37: | ||
Assemble the commands into a script file. You can name the script file as you like. See [[scripting#example|simple example]] and some [[scripts|useful scripts]]. | Assemble the commands into a script file. You can name the script file as you like. See [[scripting#example|simple example]] and some [[scripts|useful scripts]]. | ||
- | Use the ''/script'' [[commandline#scripting|command line]] option to pass the script to the WinSCP [[executables|executable]]. You can embed the complete command line into a Windows batch file (''.bat''), like as follows: | + | Use the ''/script'' [[commandline#scripting|command line]] option to pass the script to the WinSCP [[executables|executable]]. Generally, you should also use ''[[commandline#configuration|/ini=nul]]'' switch to [[scripting#configuration|isolate the script execution from GUI configuration]]. You can embed the complete command line into a Windows batch file (''.bat''), like as follows: |
<code batch> | <code batch> | ||
@echo off | @echo off | ||
- | winscp.com /script=myscript.txt | + | winscp.com /script=myscript.txt /ini=nul |
</code> | </code> | ||
Line 74: | Line 74: | ||
<code batch> | <code batch> | ||
- | winscp.com /script=script.tmp /parameter // c:\myfile.txt | + | winscp.com /script=script.tmp /ini=nul /parameter // c:\myfile.txt |
</code> | </code> | ||
Line 90: | Line 90: | ||
rem Execute script | rem Execute script | ||
- | winscp.com /script=script.tmp | + | winscp.com /script=script.tmp /ini=nul |
rem Delete temporary script | rem Delete temporary script | ||
Line 121: | Line 121: | ||
<code batch> | <code batch> | ||
- | winscp.com /script=example.txt | + | winscp.com /script=example.txt /ini=nul |
if %ERRORLEVEL% neq 0 goto error | if %ERRORLEVEL% neq 0 goto error | ||