0

I am trying to write a little project thing to get my javascript skills up. The goal is for, when using curln, the .cmd file will write %~dp0\#temp with the curl %1 (the curled html result of the first parameter)

expected with curln "https://www.google.com": (long html)
actual: "<< was unexpected at this time."

I have tried looking things up, this was a mesh of what I found online. I have tried using < and << as, a beginner, I don't understand the difference.

Code:

%~dp0\#temp << cmd curl %1

I would like the output of curl to be written to the current directory's (%~dp0) file named #temp. %1 is a preset *.cmd parameter variable that is shown in this example: example "this is %1"

0

2 Answers 2

1

> and >> are output. The first creates a new file, the second appends to an existing file. < is input. It accepts input (reads) into a program from another source, which is typically a file or the output of another program. It doesn't work with writing to files.

You're most likely looking for curl %1 >>"%~dp0#temp" instead. You don't need the cmd in front of it, as you're already in a command window when the batch file executes.

Sign up to request clarification or add additional context in comments.

1 Comment

@Compo: Corrected. Note that I just used the OP's code directly, changing the order around some. I didn't write the code.
0

For a simple transfer I use repeatedly using curl the minimal call is

curl -o "%~dpnx0" remote.url

That ensures the fileName and eXtension are saved in the current DrivePath

There is no error checking or security communication so is only useful for a single .html or .js or .pdf etc.

Thus a complex call can run to dozens of lines.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.