Question: what is nx in batch script?
Answer: %%g is the for variable to iterate through files, ~nx is the modifier to use only the Name and eXtension of the file (so excluding any path).