Question

Here is the situation. I need to "type" a .sj files content, then save it as an .js file. This is not the same as a rename, as the encoding is different. I am very new to Batch File syntax, but proficient with other programming languages. Here is what I have tried:

call for %%i in (.\*.js) do type %%i > %%i.js 

But this is giving me the "%%i is unexpected at this time" Error.

If you need me to provide more insight, I will be happy to.

BACKGROUND: Trying to use JSDoc3 on .sj files but the encoding is not compatible. Using an encoder did not work either. What did work is copying and pasting the contents into a new file with encoding UTF8. But like I stated, a program like UTFCast did not work.

Was it helpful?

Solution

Two percent signs without anything in between (in a batch file) are treated like a single percent sign in a command (not a batch file).

Moreover CALL command enables a user to execute a batch file from within another batch file.

So from cmd you need to run only below..

for %i in (.\*.js) do type %i > %i.js 

if you want to learn more...

for command

call command

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top