Getting "The token '&&' is not a valid statement separator in this version." error.

Running FileBot from the console, Groovy scripting, shell scripts, etc
Post Reply
mrm1st3r
Posts: 7
Joined: 25 Oct 2016, 09:06

Getting "The token '&&' is not a valid statement separator in this version." error.

Post by mrm1st3r »

I recently updated to the windows app version of Filebot, which I'm calling from a batch script. Although I'm now getting an error due to the "&&" in my--def exec string. This was working with the previous non-windows app version of Filebot. Is there another "token" I need to be using?

The error:

Code: Select all

At line:1 char:25
+ SET name=Game of Thrones&& SET season=Season 2&& SET episode=S02E01&& ...
+                         ~~
The token '&&' is not a valid statement separator in this version.
At line:1 char:47
+ SET name=Game of Thrones&& SET season=Season 2&& SET episode=S02E01&& ...
+                                               ~~
The token '&&' is not a valid statement separator in this version.
At line:1 char:68
+ ... =Game of Thrones&& SET season=Season 2&& SET episode=S02E01&& SET tit ...
+                                                                ~~
The token '&&' is not a valid statement separator in this version.
At line:1 char:100
+ ... ason 2&& SET episode=S02E01&& SET title=The North Remembers&& SET yea ...
+                                                                ~~
The token '&&' is not a valid statement separator in this version.
At line:1 char:116
+ ... sode=S02E01&& SET title=The North Remembers&& SET year=2011&& SET typ ...
+                                                                ~~
The token '&&' is not a valid statement separator in this version.
At line:1 char:135
+ ... itle=The North Remembers&& SET year=2011&& SET type=Episode&& SET fil ...
+                                                                ~~
The token '&&' is not a valid statement separator in this version.
At line:1 char:184
+ ... pe=Episode&& SET filepath=D:/Media/TV Shows/Game of Thrones&& CALL C: ...
+                                                                ~~
The token '&&' is not a valid statement separator in this version.
At line:1 char:301
+ ... xxxxxxxxxxxxxxxxxxxxxxx C:\Windows\System32\pushbullet.exe && CALL C: ...
+                                                                ~~
The token '&&' is not a valid statement separator in this version.
    + CategoryInfo          : ParserError: (:) [], ParentContainsErrorRecordException
    + FullyQualifiedErrorId : InvalidEndOfLine
And my --def exec string. It sets a few variables, then calls two batch scripts; The first sends a Pushbullet alert, and the second creates a list of file paths which are checked for duplicates later in my script.

Code: Select all

--def exec="SET name={n.replaceAll(/[:|]/, \" - \")}&& SET season={episode.special ? \"Special\" : \"Season \"+s}&& SET episode={episode.special ? \"S00E\"+special.pad(2) : s00e00}&& SET title={t}&& SET year={y}&& SET type={type}&& SET filepath={type=Episode ? [%disks%].collect{ (it+\"/Media/TV Shows/\"+n.replaceAll(/[:|]/, \" - \")) as File }.sort{ a, b -> a.exists() <=> b.exists() ?: a.diskSpace <=> b.diskSpace }.last() : \"\"}{type=Movie ? [%disks%].collect{ (it+\"/Media/\"+{fn =~ /3D/ ? \"3D Movies\" : \"Movies\"}+\"/\"+n.replaceAll(/[:|]/, \" - \")+\" \"+\"(\"+y+\")\"+{fn =~ /3D/ ? \" [3D]\" : \"\"}) as File }.sort{ a, b -> a.exists() <=> b.exists() ?: a.diskSpace <=> b.diskSpace }.last() : \"\"}&& CALL pushbulletalert.bat %name% %season% %episode% %title% %year% %type% %pushbulletapikey% %pushbulletvar% && CALL writeduplicatecheckpaths.bat %season% %type% %filepath% %tempvarlocation%"
Thanks for any help.
User avatar
rednoah
The Source
Posts: 22998
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Getting "The token '&&' is not a valid statement separator in this version." error.

Post by rednoah »

1.
Unrelated to the Windows Store, but related to the latest update, --def exec commands are not executed with PowerShell and not CMD.

2.
Your script is quite unreadable. What is your full amc command? Are you recreating your format? Are you sure that you can't just used the output path {f} for that?

3.
The best-practice for complex --def exec command is to simply call your script or executable. Simple calls are more or less the same in cmd, ps and bash.

e.g.

Code: Select all

--def exec="C:\horror.cmd '{n}' '{y}' ..."
:idea: Please read the FAQ and How to Request Help.
Post Reply