Skip to main content
Topic: Command line crash (Read 1912 times) previous topic - next topic

Command line crash

I did:
Code: [Select · Download]
for %a in (*.nwc) do nwc2 -convert %a info >> List.txt
and NWC crashed badly.
My bad: I forgot the quotes around the filename and some files have blanks in their filenames; but crashing is not the right way to handle such events.

I then did:
Code: [Select · Download]
for %a in (*.nwc) do nwc2 -convert "%a" info >> List.txt
No crashes this time, but no info either.

The same using a plain and simple:
Code: [Select · Download]
nwc2 -convert foo.nwc info

This worked instead:
Code: [Select · Download]
nwc2 -convert nwc mid <foo.nwc >foo.mid
but it's not what I need.

And nwc-conv isn't supported anymore...

Re: Command line crash

Reply #1
I discovered in my notes that that syntax is obsolete.
I found this:
Quote
-convert: This option can be used to convert a file from one format to another.
Usage: nwc2.exe -convert "[input-file]" "[output-file]"

Both files are required on the command line, and the file extension
determines the conversion.

Supported conversions include:
.nwc    -> .nwctxt, .mid, or .info
.nwctxt -> .nwc, .mid, or .info

Conversions to .mid support a "-0" option for type 0 files.
It works but it's far from perfect if you want to collect the info of many files, like I do. This at most creates a file .info for each nwc file.
Then I remembered that if windows uses a GDI then it doesn't support stdin and stdout and vice versa.
But, with my great wonder, my notes say also:
Quote
You can invoke the NWC Lua interpreter by adding a -nwcut switch on the command line:
nwc2 -nwcut [YOURTOOL] < nwcfile.nwctxt > outfile.txt 2> errfile.txt
You must provide the redirects, as the program instance will not
automatically attach to your current console session.
So my findings are:
  • we need the command line explained in the help (as far as I saw, it is not),
  • the command line can easily make NWC crash,
  • there is no way to collect the info of many files at once in a single file like it was with nwc-conv.