Post a reply

Add an Attachment

If you do not want to add an Attachment to your Post, please leave the Fields blank.

(maximum 10 MB; please compress large files; only common media, archive, text and programming file formats are allowed)


Topic review


Got it!

after hours of messing around the answer manifested itself about 10 minutes after I sign up to a forum and make a post as is the way of things :P

So... I put a "Pause" at the start and end of the batch file, and then I got this gem

Cannot open file "C:\Users\username\Documents\script.txt". The system cannot find the file specified

then ran the batch file from scheduler and got

Cannot open file "C:\WINDOWS\system32\script.txt". The system cannot find the file specified

so it seems that these applications are doing their own completely different things with relative paths.

changing my batch file to

"C:\" /script="C:\script.txt" /log="C:\log.txt"

has worked

can't use /script command line option when executing via VBA or task scheduler

I'm trying to execute a script to upload images onto a web server via VBA in access. I have a batch file that just has

"C:\" /script=script.txt /log=log.txt

the script file contains

option batch continue

mkdir temp
cd temp
put "image.png"
rmdir live
mv temp live

this works fine if I doubleclick the batch file, alternately this works as well (whether using a windows shortcut or a batch file)

"C:\WinSCP.exe" /console /script=script.txt /log=log.txt

It's not a typo in my file path, as I can also get access and task scheduler to execute winscp either directly, or by running the above batch file IF I remove "/script=script.txt" from the command line, but the instant I put "/script=script.txt" back in it stops working. no error, no entry in the log file. just a quick flash of black as the command prompt window appears for a fraction of a second

this behaviour exhibits itself regardless of the contents or name of the script file. I've tried two different ftp servers and even empty script files. the behaviour is the same, fine when executed manually, and failure if executed via code or scheduler. in all cases of failure when run via vba or scheduler, I can get winscp to run by leaving everything the same and removing "/script=script.txt"

any thoughts?