Shell command and variables
Shell command and variables
(OP)
hello i'm trying to run an external file through shell (C:\>file.exe parameter) and i like let the user to input the parameter in a variable. can i pass the variable to the shell? how?
sorry for my poor english, if i'm not clear please let me know.
thanks!
jul
sorry for my poor english, if i'm not clear please let me know.
thanks!
jul
RE: Shell command and variables
QB 4.5 code:
CODE
test.bat:
CODE
cls
echo In TEST.BAT
echo Parameter1 = %1
echo Parameter2 = %2
echo.
pause
Hope this helps.
RE: Shell command and variables
shell "C:\File.EXE "+Var$
The space after exe will be mandatory. If it requires
a "/" character then
shell "C:\file.exe /"+Var$
RE: Shell command and variables
THEN
In the bat file code
SET MYPARM1=%1
SET MYPARM2=%2
THEN RUN THE PROGRAM WITH THE FOLLOWING CODE AT THE BEGINNING
MYFIRSTPARM$ = ENVIRON$("MYPARM1")
MYSECONDPARM$ = ENVIRON$("MYPARM2")
NOW THE QBASIC PROGRAM CONTAINS THE PASSED STRINGS AS MYFIRSTPARM$ & MYSECONDPARM$ .
Computer thought: I teach a lot of programming so I can learn. You can never learn it all.
RE: Shell command and variables
I did it with Buff1 advice, thank you all for your interest.
now i've got another issue,
i'm getting "illegal function call" error i guess that's because the commandstring in the SHELL is too big, is there a way to fix that?
thanks again!
RE: Shell command and variables
RE: Shell command and variables
I would more likely look to an error in the code.
Without at least a snipet though, we are unable to say for
sure. Like saying "I sneezed -- what's wrong with me?"
and expecting the exact diagnosis.
RE: Shell command and variables
you used to be able to increase the set area in the cmd box up to 4k that you run the programs in. look in the system for that possibility, maybe use the properties folder on the cmd icon. Maybe it is in the windows equivalent of autoexec of config files . Sorry I don't have the time right now.
Computer thought: I teach a lot of programming so I can learn. You can never learn it all.