Page 1 of 1

How to pass complex arguments in Windows CMD?

Posted: 29 Sep 2018, 18:57
by venealis
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.

Re: Any help would be appreciated.

Posted: 30 Sep 2018, 12:33
by rednoah
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.

Re: How to pass complex arguments in Windows CMD?

Posted: 30 Sep 2018, 15:39
by venealis
thanks rednoah will give it a shot. will post results

Re: How to pass complex arguments in Windows CMD?

Posted: 21 Oct 2018, 15:38
by venealis
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?

Re: How to pass complex arguments in Windows CMD?

Posted: 21 Oct 2018, 15:42
by rednoah
What does the log say?

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

Code: Select all

--def [email protected]/path/to/MovieFormat.groovy

Re: How to pass complex arguments in Windows CMD?

Posted: 21 Oct 2018, 15:49
by venealis
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

Re: How to pass complex arguments in Windows CMD?

Posted: 21 Oct 2018, 15:56
by rednoah
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).

Re: How to pass complex arguments in Windows CMD?

Posted: 21 Oct 2018, 16:01
by venealis
will do thanks.

Re: How to pass complex arguments in Windows CMD?

Posted: 21 Oct 2018, 16:06
by venealis
appreciate you time and help