Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

How to capture the inputstream while executing cmd through java in RUNAS mode  RSS feed

 
vicky sahu
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have return a small java code to execute the SC command on Remote Server and I am using LSRunas to give the admin credentials.


The program works fine and it execute the SC command with provided credentials on remote server, but the problem is that it opens a new cmd windows to print the result (The common scenario while using RUNAS), But i want to capture the result and read it in my java program. Is there is any way i can capture the result from newly opened cmd window.
 
Jude Niroshan
Ranch Hand
Posts: 132
5
Eclipse IDE Java Postgres Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi bro,
I'm not a java expert. Bt i hope this might be helpful. webpage
 
vicky sahu
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks bro for the reply, but i am looking for something which will allow me to capture the input stream from the newly opened command prompt, while executing the command in RUNAS mode.

Thanks Again
 
Tony Docherty
Bartender
Posts: 3205
78
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Not sure what you can do with lsrunas but is it possible to pipe the output back to the original cmd prompt.
Failing that can you redirect output to a file and then read in the contents of the file.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!