I'd like to convert all my NWC files to NWCTXT.
For 1 file, I know I can do this with a command like:
"C:\Program Files (x86)\Noteworthy Software\NoteWorthy Composer 2\nwc-conv "nwc_folder\song.nwc" NWCTXT > "nwctxt_folder\song.nwctxt".
So what I need is a .bat file where I can specify the input and output folder and create a loop to convert every file with .nwc extension from the input folder to a .nwctxt file in the output folder.
But my knowledge of the syntax of .bat files is hidden far away in my memory.
So any help would be appreciated.
Put something like this in your .bat file:
for %%F in (%1\*.nwc) do call :DoIt %%F %2
goto :EOF
:DoIt
echo %1 %2
goto :EOF
Instead of echo %1 %2, do your work there: %1 is the nwc file in the input folder, %2 the output folder. There are ways to create a "naked" filename from %1 ... I'll look them up, but my battery is running low ... so I'm in a hurry ....
H.M.
This is probably a stupid question and likely not helpful, but I'll ask it and offer a possible solution anyway.
Other than the filename extension, is there any difference between .nwc and .nwctext files?
If not, there is freeware for bulk renaming. I use CKRenamer, and I imagine other, newer, programs are readily available.
End of stupid question. I'll duck now.
Not a stupid question. With current versions of NWC, a .nwc file is just a compressed version of the .nwctxt equivalent. Therefore, it's smaller on your hard drive. There are a number of sites out there for converting NWC to MusicXML or other formats, and some of those sites will only convert .nwctxt format files (i.e. they can't uncompress the .nwc).
for %%i in (*.nwc) do "C:\Programs\NoteWorthy Composer 2\nwc2.exe" -convert "%%i" "%%~dpni.nwctxt"
Edit: N.B. this is for a batch file!
For the command line:
for %i in (*.nwc) do "C:\Programs\NoteWorthy Composer 2\nwc2.exe" -convert "%i" "%~dpni.nwctxt"
Thanks for the quick answer. I like this solution without any goto (Sory H.M :)) ), but I can't get it right.
I changed it a little bit to include my input folder, to:
for %%i in (C:\Users\gustv\Documents\Music\NWC2\Kaaterliedjes\Testcopies\*.nwc) do "C:\Programs\NoteWorthy Composer 2\nwc2.exe" -convert "%%i" "%%~dpni.nwctxt
But that gave errors "Het systeem kan het opgegeven pad niet vinden.", which means, according to Google translate: "The system cannot find the path specified."
My input folder is correct (I can see all the input files in the echo lines), so maybe I have to specify the output path also, but how?
I don't know what "~dpni" means.
I think the problem is in the
In my computer it is "C:\Programmi\......." so I suppose you have it translated to flemish.
All that assuming that you don't have NWC installed elsewere, of course.
Thanks, I figured it out!
One thing though: the wildcart *.nwc also selects *.nwctxt files. Not a big problem, but a little annoying.
BTW: Where do I find the full documentation for nwc2.exe -convert?
Yes, in Windows, three-letters extension patterns match also longer filename extensions. What you can do:
for /F %i in ('dir /b *.nwc ^| findstr /e .nwc') do ...
Re the "goto EOF:", this is no real goto, but .bat's code for "return".
And my version with CALL and a separate block for the things to do is , I think, helpful if you want to execute more than one command in the loop. This is already helpful for adding some echo's for debugging. There is also a different method with parentheses
for /F %i in (...) do (
cmd1
cmd2
...
)
Here are some links:
https://stackoverflow.com/questions/2423935/windows-command-line-search-for-exact-extension-with-dir
https://www.windows-commandline.com/windows-for-loop-examples/
https://www.informit.com/articles/article.aspx?p=1154761&seqNum=10
H.M.
// Edit: | in for loop needs a ^ in front of it. Aha.
I tried this in a .bat file:
for /F %%i in ('dir /b C:\Users\gustv\Documents\Music\NWC2\Kaaterliedjes\*.nwc | findstr /e .nwc') do (
echo %i
)
Result:
So it goes :-) Now I tried it myself - this is what works:
for /F %%i in ('dir /b/s mymusic\*.nwc ^| findstr /e .nwc') do (
echo %%i
)
There's a caret before the |, and two %% after the echo.
H.M.
This worked fine
cd C:\Program Files (x86)\Noteworthy Software\NoteWorthy Composer 2
for /F "delims=" %%i in ('dir /b C:\Users\gustv\Documents\Music\NWC2\Kaaterliedjes\*.nwc ^| findstr /e .nwc') do (
nwc-conv "C:\Users\gustv\Documents\Music\NWC2\Kaaterliedjes\%%i" NWCTXT > "C:\Users\gustv\Documents\Music\NWC2\Kaaterliedjes\NWCTXT\%%itxt".
)
Opagust, are you saying that nwc-conv still works even with the newest (so-to-say :) ) version of NWC?
It can be possible, since
I can't find nwc-conv.exe anymore in my archives. Could you send me a copy of it?
Edit: Found! It was inside nwc2_UserToolStarter, not in a NWC package.
Yes, it still works!
And it puts its output on stdout (a thing I needed once).