How to pass complex arguments in Windows CMD?

Running FileBot from the console, Groovy / FileBot scripting, shell scripts, etc
Post Reply
venealis
Posts: 7
Joined: 28 Sep 2018, 13:37

How to pass complex arguments in Windows CMD?

Post by venealis » 29 Sep 2018, 18:57

Thanks in advance.

I'm a complete newB to all of this, but find it really interesting. I've been trying for multiple days to get this to work for me.
First off it works perfectly in GUI, no issues does everything i want.
What i'm looking for is how do i turn this format expression into a working .bat file. I've tried everything i can find in forums and ideas that come to me.

Have tried using it as my --def movieformat = without any luck while using AMC scripts

This is ChefGregS format expression
viewtopic.php?f=5&t=2&p=36043#p36043



any help would be awesome.
V.

User avatar
rednoah
The Source
Posts: 16303
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Any help would be appreciated.

Post by rednoah » 30 Sep 2018, 12:33

These formats are complex, so escaping them for Windows CMD / BAT is tricky. To be avoided. Use argument files instead.

:idea: Use the @file syntax for reading command-line arguments from external text files.
:idea: Please read the FAQ and How to Request Help.

venealis
Posts: 7
Joined: 28 Sep 2018, 13:37

Re: How to pass complex arguments in Windows CMD?

Post by venealis » 30 Sep 2018, 15:39

thanks rednoah will give it a shot. will post results

venealis
Posts: 7
Joined: 28 Sep 2018, 13:37

Re: How to pass complex arguments in Windows CMD?

Post by venealis » 21 Oct 2018, 15:38

thanks for the help rednoah got it working for the most part. Problem i'm having now is that when i run this movie.bat file:

Code: Select all

filebot -script fn:amc C:\Users\Vince\Downloads\complete --output //SYNOLOGY/Movies --log-file amc.log --def clean=y --def artwork=y --action move --def excludeList=amc.txt --def movieFormat= C:\Users\Vince\Documents\FilebotScripts\args.txt
with this args.txt file:

Code: Select all

{vf == /2160p/ ? 'L:/Movies 4K' : vf =~ /1080p|720p/ ? 'M:/Movies HD' : 'Z:/Movies'}/{n.upperInitial().colon(' - ').replace('?', '!')} {' (' + fn.matchAll(/extended|uncensored|remastered|unrated|uncut|directors.cut|special.edition|redux/)*.upperInitial()*.lowerTrail().sort().join(', ').replaceAll(/[._]/, " ") + ')'} {any{' Part '+pi}{null}} ({y}) {fn.match(/3D/)}/{n.upperInitial().colon(' - ').replace('?', '!')} {' (' + fn.matchAll(/extended|uncensored|remastered|unrated|uncut|directors.cut|special.edition|redux/)*.upperInitial()*.lowerTrail().sort().join(', ').replaceAll(/[._]/, " ") + ')'} {any{' Part '+pi}{null}} [{y}, {any{csv('M:/replacecert1.csv').get(certification)}{certification}{"NR"} }, {runtime} Min] {[actors.take(3).join(', ')]} {[genres.take(3).join(', ')]} [{fn.match(/3D/)+', '}{"$vf, [email protected]$af"}]{subt} 
it deletes my .txt file. They obviously are not stored in the same folder. Do i need to add this to a exclude script?

User avatar
rednoah
The Source
Posts: 16303
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: How to pass complex arguments in Windows CMD?

Post by rednoah » 21 Oct 2018, 15:42

What does the log say?

It's called @file because there's an @ character:

Code: Select all

--def [email protected]/path/to/MovieFormat.groovy
:idea: Please read the FAQ and How to Request Help.

venealis
Posts: 7
Joined: 28 Sep 2018, 13:37

Re: How to pass complex arguments in Windows CMD?

Post by venealis » 21 Oct 2018, 15:49

log file actually states that it did delete when performing the cleaning script. but why is it cleaning that file?
when i tried the @ format kept giving me errors. "illegal arguments" if i remember correctly

User avatar
rednoah
The Source
Posts: 16303
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: How to pass complex arguments in Windows CMD?

Post by rednoah » 21 Oct 2018, 15:56

Please read up on how CMD arguments work:
viewtopic.php?f=4&t=1899


GOOD:

Code: Select all

--def [email protected]:\Users\Vince\Documents\FilebotScripts\args.txt
Read 2 arguments, [--def] and [[email protected]:\Users\Vince\Documents\FilebotScripts\args.txt] as it should be.


BAD:

Code: Select all

--def movieFormat= C:\Users\Vince\Documents\FilebotScripts\args.txt
Because this parses to 3 arguments, [--def] [movieFormat=] [C:\Users\Vince\Documents\FilebotScripts\args.txt], you're passing in an EMPTY movie format which is subsequently ignored (likely with an error message telling you specifically that movieFormat is off), and then the next argument is interpreted as input file, so you're passing in your text file for processing (and cleaning).
:idea: Please read the FAQ and How to Request Help.

venealis
Posts: 7
Joined: 28 Sep 2018, 13:37

Re: How to pass complex arguments in Windows CMD?

Post by venealis » 21 Oct 2018, 16:01

will do thanks.

venealis
Posts: 7
Joined: 28 Sep 2018, 13:37

Re: How to pass complex arguments in Windows CMD?

Post by venealis » 21 Oct 2018, 16:06

appreciate you time and help

Post Reply