2

Can someone help me!?!

So I have half a batch (.bat) half javascript script. From clarion I send 3 arguments

  • 0: name of .bat (the batch script)
  • 1: list of arguments
  • 2: a name (string text)

I want to know how to get my variable in batcsh and transfer it to JavaScript.

CLARION:
    runscr= 'script.bat ' & 'data.tps' & 'myname'
    RUN(runscr,1)

script.bat

@if (@a==@b) @end  

       @echo off
       setlocal enabledelayedexpansion

       echo %~nx0 
       echo %1
       echo %2
       pause

    cscript /nologo /e:Jscript 
    ...

echo %~nx0 prints: script.bat

echo %1 prints: data.tps

echo %2 prints: myname

Thanks in advance

Joxy
  • 41
  • 4
  • For me you are trying to run this command "script.bat data.tpsmyname" , and its look strange, can you offer an working example how you write on DOS command line using your script.bat. – Y. M. Oct 04 '17 at 14:32
  • how to send in to Jscript? – Joxy Oct 05 '17 at 07:11
  • If it's not something like `cscript myjscript.js //nologo //e:Jscript %1 %2` then you need to explain in more detail what you're trying to do (and have already tried). (I've doubled the slashes, as per the help-text generated from `cscript /?` -- but I assume you've already read that). – TripeHound Oct 05 '17 at 07:40
  • That's what I want to know.... when I do `cscript /nologo /e:Jscript %0 %1 %2 ` how do I receive it below in JScript. How do I put them in a variable. – Joxy Oct 05 '17 at 08:18
  • So is your question really "_How do I **access** command-line arguments from CScript /JavaScript_"? In Node.js you would use the array `process.argv` (see [this answer](https://stackoverflow.com/a/4351548/2096401); for CScript (albeit using VBS instead of JS) it seems to be `WScript.Arguments` (see, for example, [this answer](https://stackoverflow.com/a/10091907/2096401)). If it's neither of those, you'll have to do some more searching. – TripeHound Oct 05 '17 at 10:34

0 Answers0