2

I have here a sample code that I use (came from another stackoverflow thread). I don't have any question on how this runs.

I am just wondering what are the /* and */ symbols for?

    @set @a=0  /*

    ::modify input file and output file
    @cscript //nologo //E:JScript "%~F0" < names.txt > output.txt

    ::modify output file and result file
    :: @move /Y output.txt names_result.csv
    type output.txt > names_result.csv

    ::end
    @goto :EOF */


WScript.Stdout.Write(WScript.StdIn.ReadAll().replace(/\t/g,","));
jaxarroyo
  • 190
  • 2
  • 15
  • This is kind of an indirect answer, found in this stackoverflow thread. https://stackoverflow.com/questions/29815636/and-in-java-comments/29815698 Short-hand /* */ is used to write block (multi line) comments in javascript – Steven Zheng Aug 18 '17 at 04:12
  • hi steven, yes i know this is comment on java. But this is batch scripting that I am on right now. Comments for batch is "REM" and "::". But not "/*" and */". – jaxarroyo Aug 18 '17 at 04:13

1 Answers1

2

This is a way to embed a java script in a cmd file. See also here. The trick is to make JS believe it's defining set, and after that the /* */ will gobble the cmd lines that have been used to run the script. Just read it two times, once as a cmd shell and once as the JS engine.

yacc
  • 2,915
  • 4
  • 19
  • 33