WinBatch® Technical Support Forum

All Things WinBatch => WinBatch => Topic started by: kle2 on February 05, 2025, 07:57:07 AM

Title: Illegal delimiter found
Post by: kle2 on February 05, 2025, 07:57:07 AM
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
Title: Re: Illegal delimiter found
Post by: JTaylor on February 05, 2025, 08:19:55 AM
You are missing the first quote for 1.txt".

Jim
Title: Re: Illegal delimiter found
Post by: kle2 on February 05, 2025, 08:32:34 AM
Quote from: JTaylor on February 05, 2025, 08:19:55 AMYou are missing the first quote for 1.txt".

Jim

Yeah..Thanks, Jim!
Title: Re: Illegal delimiter found
Post by: 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.
Title: Re: Illegal delimiter found
Post by: kle2 on February 05, 2025, 10:56:07 AM
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.
Title: Re: Illegal delimiter found
Post by: snowsnowsnow on February 05, 2025, 02:29:38 PM
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...
Title: Re: Illegal delimiter found
Post by: JTaylor on February 06, 2025, 05:53:10 AM
He changed the original post.   


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

was


script = FileOpen(1.txt", "WRITE")
Title: Re: Illegal delimiter found
Post by: kle2 on February 06, 2025, 06:36:57 AM
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!