title: embed JS code in a batch file
body: <p>i have a batch file preparing word files by renaming and relocating them. 
  so that i make pdf for this files using a javascript code i ve found in this website. i call it as follows;</p>
  
  <pre><code>for %%g in ("test\*.doc") do (cscript.exe //nologo "SAVEASPDF.js" "%%~fg") 
  </code></pre>
  
  <p>this JavaScript code is in another file as <code>saveaspdf.js</code> to make PDF.
  can i embed a JS code inside the batch file (e.g. as a <code>:FUNCTION</code>)  to keep all the code in a single file only? </p>
  
  <p>here is the JS i m trying to embed, i found it here in this website. </p>
  
  <pre><code>var fso = new ActiveXObject("Scripting.FileSystemObject");
  var docPath = WScript.Arguments(0);
  docPath = fso.GetAbsolutePathName(docPath);
  
  var pdfPath = docPath.replace(/\.doc[^.]*$/, ".pdf");
  var objWord = null;
  
  try
  {
      WScript.Echo("Saving '" + docPath + "' as '" + pdfPath + "'...");
  
      objWord = new ActiveXObject("Word.Application");
      objWord.Visible = false;
  
      var objDoc = objWord.Documents.Open(docPath);
  
      var wdFormatPdf = 17;
      objDoc.SaveAs(pdfPath, wdFormatPdf);
      objDoc.Close();
  
      WScript.Echo("Done.");
  }
  finally
  {
      if (objWord != null)
      {
          objWord.Quit();
      }
  }
  </code></pre>