views:

20

answers:

3

I've need to get a file from a remote (embedded) system (which I can do either by wget or an ftp command) then print the contents of the file.

Once I've retrieved and printed the file I don't want to do it again.

It's a simple matter to make the embedded system publish a file that contains a number, or directory listing which the host system can use to determine if there is something 'new', but I'm completely clueless when it comes to scripting under Windows.

The host is Windows-7.

Suggestions?

A: 

You might be able to do it with a batch file.

Jon Cage
You may as well have suggested "Try programming something." for all the illumination you provided
Jamie
I thought the batch file reference might get you started, but fair enough. Does MSalters not deserve a downvote for the same reason if you're in a vindictive mood?
Jon Cage
A: 

The low-tech solution would be batch files - just a list of instructions parseable by CMD.EXE. However, Windows gained a far more powerful scripting language, "PowerShell".

You obviously need to store local state somehow - if you don't remember what you printed, you can't implement this system at all.

MSalters
A: 

I ended up using some of the excellent tools provided by Simon Tatham here.

The batch file was simply:

:START
pscp -q -batch -l root -pw root 10.0.2.67:/tmp/results2.txt c:/DX12/
IF "%ERRORLEVEL%" == "1" GOTO START
plink -l root -pw root 10.0.2.67 rm /tmp/results2.txt

The second part of the problem, printing was done by naming a printer share on the local machine and invoking a "net use" command to make the printer available to a command line ala LPT2:

Jamie