How do I double-quote argument values that contains double-quote characters themselves?

Running FileBot from the console, Groovy scripting, shell scripts, etc
Post Reply
1AnimeFinder
Posts: 5
Joined: 12 Sep 2023, 23:27

How do I double-quote argument values that contains double-quote characters themselves?

Post by 1AnimeFinder »

trying to make a all in one Scripting
can anyone help me with this or maybe have one to show me?
my code im try to get to working but it not working

Code: Select all

"C:\Program Files\FileBot\filebot.exe" -script fn:amc --action duplicate --conflict skip -non-strict "X:\Plex Collection\need work" --output "X:/Media" --def movieFormat="X:/Media/Movies/{anime ? "Anime Movies" : genres.contains('Animation') ?  "Animation Movies" : "Movies"}/{n} ({y})/{fn}" seriesFormat="X:/Media/Series/{anime ? "Anime" : genres.contains('Animation') ?  "TV Shows Animation" : "TV Shows"}/{ny}/{episode.special ? 'Specials' : 'Season 0'+s}/{fn}" animeFormat="X:/Media/Anime/{anime ? "Anime" : genres.contains('Animation') ?  "TV Shows Animation" : "TV Shows"}/{ny}/{episode.special ? 'Specials' : 'Season 0'+s}/{fn}" musicFormat="X:/Media/Audio/{ ~plex } --log-file amc.log --def excludeList=amc.excludes --def unsorted=y music=y artwork=y "ut_label=%L" "ut_title=%N" "ut_kind=multi" "ut_dir=%F"
im get this

Code: Select all

[PSA] Important Discussion of Changes effective as of 28 Apr 2023:
https://www.filebot.net/forums/viewtopic.php?t=13406

Parameter: movieFormat = X:/Media/Movies/{anime ? Anime
Argument[0]: X:\Plex Collection\need work
Argument[1]: File does not exist: X:\\Movies : genres.contains('Animation') ?  Animation
Argument[2]: File does not exist: X:\\Movies : Movies}\{n} ({y})\{fn}
Argument[3]: File does not exist: X:\\seriesFormat=X:\Media\Series\{anime ? Anime : genres.contains('Animation') ?  TV
Argument[4]: File does not exist: X:\\Shows
Argument[5]: File does not exist: X:\\Animation : TV
Argument[6]: File does not exist: X:\\Shows}\{ny}\{episode.special ? 'Specials' : 'Season 0'+s}\{fn}
Argument[7]: File does not exist: X:\\animeFormat=X:\Media\Anime\{anime ? Anime : genres.contains('Animation') ?  TV
Argument[8]: File does not exist: X:\\Shows
Argument[9]: File does not exist: X:\\Animation : TV
Argument[10]: File does not exist: X:\\Shows}\{ny}\{episode.special ? 'Specials' : 'Season 0'+s}\{fn}
Argument[11]: File does not exist: X:\\musicFormat=X:\Media\Audio\{ ~plex } --log-file amc.log --def excludeList=amc.excludes --def unsorted=y music=y artwork=y ut_label=N ut_kind=multi ut_dir=F
File does not exist: X:\\Movies : genres.contains('Animation') ?  Animation
File does not exist: X:\\Movies : Movies}\{n} ({y})\{fn}
File does not exist: X:\\seriesFormat=X:\Media\Series\{anime ? Anime : genres.contains('Animation') ?  TV
File does not exist: X:\\Shows
File does not exist: X:\\Animation : TV
File does not exist: X:\\Shows}\{ny}\{episode.special ? 'Specials' : 'Season 0'+s}\{fn}
File does not exist: X:\\animeFormat=X:\Media\Anime\{anime ? Anime : genres.contains('Animation') ?  TV
File does not exist: X:\\Shows
File does not exist: X:\\Animation : TV
File does not exist: X:\\Shows}\{ny}\{episode.special ? 'Specials' : 'Season 0'+s}\{fn}
File does not exist: X:\\musicFormat=X:\Media\Audio\{ ~plex } --log-file amc.log --def excludeList=amc.excludes --
Failure (?_?)??
User avatar
rednoah
The Source
Posts: 22998
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: trying to make a all in one Scripting CMD .please Help

Post by rednoah »

:?: What happens if you use "..." to quote an argument value, but that value happens to also contain " characters? The console output above shows you what's going on. You end up with random end-quote / begin-quote in your command-line which leads to very confusing command-line argument values getting passed along to the called executable and subsequently interpreted as relative file paths.

:arrow: Compare & Contrast:

Shell: Select all

filebot -script fn:sysenv "XY"

Shell: Select all

filebot -script fn:sysenv "X"Y""

Shell: Select all

filebot -script fn:sysenv "X..." Y "...Z"

:arrow: Please read Cmdline and Argument Passing for details. Reading up on how "..." and friends work will save you a lot of time debugging badly quoted arguments.


:arrow: Once you understand the problem, the solution is to bypass the problem altogether by using @file syntax for reading command-line arguments from external text files.
:idea: Please read the FAQ and How to Request Help.
1AnimeFinder
Posts: 5
Joined: 12 Sep 2023, 23:27

Re: How do I double-quote argument values that contains double-quote characters themselves?

Post by 1AnimeFinder »

sorry new to this can u show me with my code plz
User avatar
rednoah
The Source
Posts: 22998
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: trying to make a all in one Scripting CMD .please Help

Post by rednoah »

rednoah wrote: 13 Sep 2023, 06:53 :arrow: Please read Cmdline and Argument Passing for details. Reading up on how "..." and friends work will save you a lot of time debugging badly quoted arguments.

:arrow: Once you understand the problem, the solution is to bypass the problem altogether by using @file syntax for reading command-line arguments from external text files.
:arrow: Please read Cmdline and Argument Passing and @file syntax. Click on the link. Open the page. Read the page. Twice. Read line by line every line. Do not just skim the page. Reading up on how things work for 15 minutes one time will save you many hours of painful trial and error for literally the rest of your life time.

:!: Every single command-line users will run into the "nested double-quotes" problem. It's not a filebot thing. It is normal and inevitable for any new command-line user. That's why we wrote the Cmdline and Argument Passing primer for you. Please do read it.




:arrow: This is my recommended solution:
rednoah wrote: 07 Dec 2015, 07:17 FileBot allows you specify argument files via @/path/to/file syntax, so you can pass in your complex command-line arguments via separate text files line by line without having to worry about quoting or escaping anything.

e.g. pass all arguments via an external text file:

Shell: Select all

filebot @/path/to/args.txt
** this is not the only solution but it is the easiest solution once you understand the complexities of Cmdline and Argument Passing and why you may want to bypass those complexities altogether
:idea: Please read the FAQ and How to Request Help.
1AnimeFinder
Posts: 5
Joined: 12 Sep 2023, 23:27

Re: How do I double-quote argument values that contains double-quote characters themselves?

Post by 1AnimeFinder »

Ok I got it to work but it naming the wrong name is there a way where I can pick the name for them plz and thanks you @rednoah
User avatar
rednoah
The Source
Posts: 22998
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: How do I double-quote argument values that contains double-quote characters themselves?

Post by rednoah »

1AnimeFinder wrote: 16 Sep 2023, 22:28 Ok I got it to work but it naming the wrong name
Please paste the console output so that we can see input file paths and output file paths:
viewtopic.php?t=1868
:idea: Please read the FAQ and How to Request Help.
1AnimeFinder
Posts: 5
Joined: 12 Sep 2023, 23:27

Re: How do I double-quote argument values that contains double-quote characters themselves?

Post by 1AnimeFinder »

is there a way where I can pick the name for them plz and thanks you .. what the what the Consol command I have to add to it o …I have no log I gave up and is the gui
User avatar
rednoah
The Source
Posts: 22998
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: How do I double-quote argument values that contains double-quote characters themselves?

Post by rednoah »

If you're using the GUI, then I would need screenshots to see what you see, and understand the problem that you are facing:
viewtopic.php?t=1868

Feel feel to create a new topic. If your question is no longer related to the original post.
:idea: Please read the FAQ and How to Request Help.
Post Reply