Batch file to upload .txt to FTP

I just put HELLO.TXT in your ftp root by; 1. Saving this as MYFTP.bat: @echo off echo user [email protected]> ftpcmd.dat echo ahktest>> ftpcmd.dat echo put %1>> ftpcmd.dat echo quit>> ftpcmd.dat ftp -n -s:ftpcmd.dat ftp.proflightsimulatoreview.com del ftpcmd.dat 2. From the command line, in the same directory as MYFTP.BAT, running; MYFTP.BAT c:\temp\hello.txt result 220———- Welcome to Pure-FTPd … Read more

Batch goto loses errorlevel

In most circumstances, || is the most reliable way to detect an error. But you have stumbled on one of the rare cases where ERRORLEVEL works but || does not. The problem stems from the fact that your error is raised within a batch script, and || responds to the return code of the most … Read more

Batch file for PuTTY/PSFTP file transfer automation

You need to store the psftp script (lines from open to bye) into a separate file and pass that to psftp using -b switch: cd “C:\Program Files (x86)\PuTTY” psftp -b “C:\path\to\script\script.txt” Reference: https://the.earth.li/~sgtatham/putty/latest/htmldoc/Chapter6.html#psftp-option-b EDIT: For username+password: As you cannot use psftp commands in a batch file, for the same reason, you cannot specify the username … Read more

Executing cmd.exe commands from Java

That’s because echo is not an external executable command (i.e., there is no echo.exe file on your hard disk, unless you put it there yourself). It’s an internal command of the shell. You’ll probably find that you need to execute something like: cmd.exe /c echo hello

Change CodePage in CMD permanently?

In the 1809 build of Windows 10 I’ve managed to permanently solve this by going to the system’s Language settings, selecting Administrative language settings, clicking Change system locale… and checking the Beta: Use Unicode UTF-8 for worldwide language support box and then restarting my pc. This way it applies to all applications, even those ones … Read more