Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

"> was unexpected at this time." - batch/command script

I'm using the batch script below:

FOR /F "TOKENS=1 DELIMS=" %%I in ('FTP -s:%FTPFIL% > log.txt') DO SET /A FTPNUM=%%I

and get an error:

> was unexpected at this time.

What is the cause of this error?

like image 905
funyao Avatar asked Jun 06 '26 08:06

funyao


1 Answers

Put your entire command into doublequotes

('"FTP -s:%FTPFIL% > log.txt"')

Or escape the redirection with a caret

('FTP -s:%FTPFIL% ^> log.txt')
like image 107
Compo Avatar answered Jun 10 '26 19:06

Compo



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!