I have been using the following script with the google closure compiler for years. I never had to look at it, it just worked - I don't even know where I originally had it from, and some parts of it I don't even understand.
However, now it doesn't correctly use the file paths from the DIR
part. Instead, it takes a far away superdirectory. I mean, if the said "dev" directory is at c:\some\long\path\to\dev
, the %%f
used is suddenly c:\some\long
instead of c:\some\long\path\to\dev\output\someScript.js
.
Running the DIR part individually returns the correct list of complete, absolute paths all the way to the intended files. Running the batch script from cmd yields the same error as running it with a double-click (both ways worked before).
Between the last time the script ran and now, I have not changed anything that I would know of. This is all on a Windows 8 machine.
@echo off
echo compressing files:
for /f %%f in ('DIR /b /s ..\..\dev\output\*.js') do (
echo %%~nxf
java -jar compiler.jar --charset UTF-8 --js "%%f" --js_output_file "..\..\files\%%~nxf"
)
set /p id="Done. Hit enter to close!"
What is wrong?