0

I have a batch file that has options, but i wish to automate those options but i do not know which is which.

after the batch is run it then prompts for a password, which i would also like to automate from the same file. (security needs are low / not of paramount importance)

The .bat

@echo off

java -Xss256k -Djava.awt.headless=true -Djava.net.preferIPv4Stack=true -jar BubbleUPnPTetherClient.jar %1 %2 %3 %4 %5 %6 %7 %8 %9

Q. How can i find out these choice values and automate this script when executed?

  • 1
    The batchfiles asks for a password? Or the Java program which it starts asks for a password? – Hennes Jun 30 '16 at 14:20
  • @Hennes the java prg asks once the batch runs. – Derple Jun 30 '16 at 14:24
  • Do you have the source for that java program? (it is java afterall, you should be able to edit in it). Also, is it asking a password to start using the program or is it asking for a wireless key or a code of whatever you tether to? – Hennes Jun 30 '16 at 14:27
  • i have the JAR file, and it is a request from the tether control point that requests password. – Derple Jun 30 '16 at 14:48
0

part 1: Batch files.

The part of the batch file which you started does the following:

Open a prompt (e.g. cmd.exe) and type mybatch.bat red white blue.
That will start a file called 'mybatch.bat'

Inside that batch file you have access to a few variables. In our example: %0 is mybatch.bat (the program name)
%1 is red
%2 is white
%3 is blue
%4 is empty in our example, ...


part 2: Java.

java -Xss256k -Djava.awt.headless=true -Djava.net.preferIPv4Stack=true -jar BubbleUPnPTetherClient.jar %1 %2 %3 %4 %5 %6 %7 %8 %9

java Starts the java interpreter.

This is followed by some options. E.g. -Xss256k , -Djava.awt.headless=true and -Djava.net.preferIPv4Stack=true

Most of these are not interesting to us atm.

-jar BubbleUPnPTetherClient.jar

Your actual java program does not do much interesting (at least not for you). It mere executes orders. The .jar file has the ist of orders. (e.g. ask for a password, connect to some device using that password, pass tethered data along, ...'


Solutions.

One of the instructions will be to ask for that password. That means you want to edit the jar file. Maybe permanently add the password to its code.

Alternatively it might accept the password as on of its input parameters. This should be in the program manual. In that case you could start it with something like this: java -Xss256k -Djava.awt.headless=true -Djava.net.preferIPv4Stack=true -jar BubbleUPnPTetherClient.jar PASSWORD

(You could also supply that password to the batchfile. That %1 things will then pass whatever you typed to the java program).

Thirdly, if neither works we are out of luck. Switch to another program or use somthing like autoIT to do things on events.

|improve this answer|||||

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.