Archive: Answer to parameter prompt in console


Answer to parameter prompt in console
hello,

I have very little experience in nsis and my english is not very good (sorry ;-)), bad i'm gona try to explain my doubt.

I want to execute a command line app. This app ask for some parameter. I'm trying to pass this parameters using ExecDos plugin, bad the app only accept the first parameter.

I have done some basic example. First i do a bat file:

@echo off
set /p choice1=Entrada 1:
set /p choice2=Entrada 2:
IF "%choice1%"=="hola1" ( IF "%choice2%"=="hola2" notepad.exe )

Then i call with:

ExecDos::exec /DETAILED /TIMEOUT=10000 "$EXEDIR\prueba.bat" "hola1$\r$\nhola2$\r$\n"

bad don't work.

If the bat file is:

@echo off
set /p choice1=Entrada 1:
IF "%choice1%"=="hola1" notepad.exe

and i call it with:

ExecDos::exec /DETAILED /TIMEOUT=10000 "$EXEDIR\prueba.bat" "hola1$\r$\n"

Then it work fine.

Can i make what i want?? Can i pass more than one parameter?? how??

Thanks for any help


Sorry!! change "bad" for "but" :-(


Use stdin_string instead. See:
http://nsis.sourceforge.net/ExecDos_plug-in


hello,

I'm using the first example in this page.

ExecDos::exec /TIMEOUT=2000 "$EXEDIR\consApp.exe" "test_login$\ntest_pwd$\n" "$EXEDIR\execdos.log"
Pop $0 # return value
MessageBox MB_OK "Exit code $0"

I just exchange "test_login$\ntest_pwd$\n" for "hola1$\nhola2$\n".

The end result is the same. When i test only with one parameter "hola1$\n", adapting the bat file for that, work fine. With two parameter don't work.

I'm doing something wrong??? I suppose yes :-)


For me this looks like messing of command line parameters and program stdin. Second parameter of ExecDos is program standard input. If you want run bat file with command line parameters just use something like '"$EXEDIR\prueba.bat" hola1 hola2' in ExecDos or nsExec first parameter.


I don't think he is mixing it up. "set /p const=Enter some text: " will prompt the user to enter some text.

Stu


I can't pass the strings to application as parameters in one command line. The .bat i have done is only an example for explain what i want (sorry because probably i have complicated it).

Really i have a console application that let me change a smartcard pin. The command is "pkcs11-tool --module=aetpkss1.dll --change-pin".

This application don't accept the old and new pin as parameter. The aplication always shows the messages:

- Insert the old pin: then i must enter the actual pin
- Insert the new pin: Then i must enter the new pin
- Confirm the new pin: then i must confirm

I want to call this command application and send this valors of pins when the application ask for its.

it is possible???

Thanks!!!