You are not logged in.

abcuser

Unregistered

1

Tuesday, January 13th 2009, 5:27pm

How to execute operating system command?

Hi,
using Console Application:
1. I would like to execute operating system command for example:

Source code

1
dir /w /a-d /on

How to execute it from Jabaco?

2. And second little more complicated. Is it possible to execute the code in current CMD windows without opening new process?
For example I connect to IBM DB2 database using command from CMD (this is executed directly on CMD not through Jabaco program):

Source code

1
db2 connect to mydatabase


But then I would like to check if database is connected successfully. So I need to execute command:

Source code

1
db2 connect

and this code I would like to execute through Jabaco program. (And a lot of other commands, just to simplify the sample). But what is important is I need to execute this command in the same process as CMD. If Jabaco opens new process I will get no connection info from my program. So is it possible to execute external operating system command with Jabaco in the same process as CMD? If it is possible, I would be very happy if somene could write some sample.
Regards

abcuser

Unregistered

2

Tuesday, January 13th 2009, 5:41pm

Hi,
I see I can execute command:

Source code

1
Shell "calc.exe"

to execute Calculator on Windows.

But what about "

Source code

1
dir /w /a-d /on

or

Source code

1
db2 connect


Running both commands from shell command returns no result. Any idea?
Regards

abcuser

Unregistered

3

Tuesday, January 13th 2009, 6:02pm

Hi,
as I see command:

Source code

1
Shell "dir /w /a-d /on"
doesn't output any result.
If I put this command in batch file sample: mycode.bat and write "dir /w /a-d /on" in batch file and then execute

Source code

1
Shell "mycode.bat" 
then still no result is returned to screen.

But if i redirect this command to file, sample: "dir /w /a-d /on > c:\mycode.txt" in batch file and execute: Shell "mycode.bat" from Jabber, then output of dir command is written in txt file.

But if I put the whole command in Jabber like:

Source code

1
Shell "dir /w /a-d /on > c:\mycode.txt"

and there is no file generated on c:\ directory.

It is little bit strange... Don't quite understand this behaviour.

How to display dir command from Shell (the same question for "db2 connect" command)?
Regards

abcuser

Unregistered

4

Wednesday, January 14th 2009, 7:54am

Hi,


Command Shell "dir /w /a-d /on" runs successfully, but doesn't output any result.

I am just wondering is this a bug in Jabaco?
Regards

Rate this thread
WoltLab Burning Board