mIRC Home    About    Download    Register    News    Help

Print Thread
reading contents of a cmd window? experts required #216949 25/12/09 01:18 AM
Joined: Oct 2005
Posts: 827
P
pouncer Offline OP
Hoopy frood
OP Offline
Hoopy frood
P
Joined: Oct 2005
Posts: 827
I currently run a java class via mirc, like this:

RUN java SomeJavaClass param1 param2etc

how can i get the contents of the cmd window? as the java program just prints the output to the window via System.out.println(...)

Last edited by pouncer; 25/12/09 01:18 AM.
Re: reading contents of a cmd window? experts required [Re: pouncer] #216952 25/12/09 04:10 AM
Joined: Oct 2005
Posts: 1,741
G
genius_at_work Offline
Hoopy frood
Offline
Hoopy frood
G
Joined: Oct 2005
Posts: 1,741
You should be able to pipe the output into a file:

Code:

/run command param1 param2 param3 > output.txt


(untested)

-genius_at_work

Re: reading contents of a cmd window? experts required [Re: genius_at_work] #216965 25/12/09 12:03 PM
Joined: Oct 2005
Posts: 827
P
pouncer Offline OP
Hoopy frood
OP Offline
Hoopy frood
P
Joined: Oct 2005
Posts: 827
I wanted to avoid writing contents to text files and then reading from text files. But if there is no other way then I guess I have to do it like that.

Re: reading contents of a cmd window? experts required [Re: genius_at_work] #216974 25/12/09 08:58 PM
Joined: Oct 2005
Posts: 827
P
pouncer Offline OP
Hoopy frood
OP Offline
Hoopy frood
P
Joined: Oct 2005
Posts: 827
Originally Posted By: genius_at_work
You should be able to pipe the output into a file:

Code:

/run command param1 param2 param3 > output.txt


(untested)

-genius_at_work


Nope that didn't seem to work, couldnt get it to output into the file.

My curent dirty workaround is having the java class write the contents to a textfile. and then when i make mirc run the command, i read the textfile after 1 second

Code:
	public static void main(String[] args) {
		String outputFile = args[0], challenge = args[1];
		String response = generateChallenge(challenge);
		
		System.out.println(response);
		
		FileOutputStream fout;
		
		try
		{
		    fout = new FileOutputStream (outputFile);
		    new PrintStream(fout).println (response);
		    fout.close();		
		}
		catch (IOException e)
		{
		}
	}


notice my run command uses a java class.. so your run command you posted would make > output.txt - my java class would think they are parameters which is not what i want

Last edited by pouncer; 25/12/09 09:10 PM.
Re: reading contents of a cmd window? experts required [Re: pouncer] #216979 26/12/09 10:54 AM
Joined: Dec 2008
Posts: 95
A
asdfasdf Offline
Babel fish
Offline
Babel fish
A
Joined: Dec 2008
Posts: 95
http://www.kthx.net/clb/exec/

Been using it for the rsa_respond tool.

Re: reading contents of a cmd window? experts required [Re: asdfasdf] #216980 26/12/09 12:05 PM
Joined: Oct 2005
Posts: 827
P
pouncer Offline OP
Hoopy frood
OP Offline
Hoopy frood
P
Joined: Oct 2005
Posts: 827
Originally Posted By: asdfasdf
http://www.kthx.net/clb/exec/

Been using it for the rsa_respond tool.


Hmm, interesting. Will have a look, thanks.