Illegal delimiter found

Started by kle2, February 05, 2025, 07:57:07 AM

Previous topic - Next topic

kle2

Hello everyone,

I tried to write a string below onto a text file but got error "Illegal delimiter found". 

script = FileOpen("1.txt", "WRITE")
FileWrite(script,"$response.data | ForEach-Object {")
FileClose(script)

Does anyone have a work around for this?

Thanks in advance!
kle2

JTaylor

You are missing the first quote for 1.txt".

Jim

kle2


spl

Quote from: kle2 on February 05, 2025, 07:57:07 AMHello everyone,

I tried to write a string below onto a text file but got error "Illegal delimiter found". 

script = FileOpen("1.txt", "WRITE")
FileWrite(script,"$response.data | ForEach-Object {")
FileClose(script)

Does anyone have a work around for this?

Thanks in advance!
kle2


Despite what Jim wrote, seems a mix-up of WB and PS code.
Stan - formerly stanl [ex-Pundit]

kle2

Quote from: spl on February 05, 2025, 09:49:12 AM
Quote from: kle2 on February 05, 2025, 07:57:07 AMHello everyone,

I tried to write a string below onto a text file but got error "Illegal delimiter found". 

script = FileOpen("1.txt", "WRITE")
FileWrite(script,"$response.data | ForEach-Object {")
FileClose(script)

Does anyone have a work around for this?

Thanks in advance!
kle2


Despite what Jim wrote, seems a mix-up of WB and PS code.

Yes, correct!  But whatever in the " ", Winbatch sees them as string.

snowsnowsnow

Although it is of course impossible to tell what's really going on here, I think OP's intent is to use WB to write another script, written in some other language - presumably, based on your (spl's) comments, that other language is PS.

That said, I don't understand the comments about there being a missing quote.  As far as I can tell, all the quotes are matched in the OP's OP.  Am I missing something?

It would, of course, help if OP would tell us on which line WB flagged an error...

JTaylor

He changed the original post.   


script = FileOpen("1.txt", "WRITE")

was


script = FileOpen(1.txt", "WRITE")

kle2

Quote from: JTaylor on February 06, 2025, 05:53:10 AMHe changed the original post.   


script = FileOpen("1.txt", "WRITE")

was


script = FileOpen(1.txt", "WRITE")

That is correct.  I am sorry for the confusion!