How to pass DOS command

I am trying to use Java to pass DOS command to command prompt. Can anyone give me some idea on how to do that?

Runtime.getRuntime().exec("docommand here");

Similar Messages

  • How to execute Dos Command 'Pause' from Java ?

    How to execute Dos Command 'Pause' from Java ?
    I have read the article in javaworld for Runtime.exec() anomalies.
    Can someone please give an insight on this?

    Thanks Buddy!
    That was very useful. Even though its a simple
    solution, I never thought about that.Bullshit! Reread reply #7 of http://forum.java.sun.com/thread.jspa?threadID=780193

  • How to execute DOS command in Java?

    I want to execute a dos command in Java,such as execute test.bat command? How to realize it?
    Thanks in advance!

    http://www.javaworld.com/javaworld/jw-12-2000/jw-1229-traps.html
    I found this article really useful in solving this. Hope it helps.
    Cheers,
    John

  • How to pass a command line argument to a jsp file...

    Hi guys,
    I'm writing a jsp file in which I have some java codes. I want to pass some command line arguments to that jsp file. In other words, I have some files located somewhere on my C drive and I want to pass the path to these files to my jsp file. How can it be done? I have never done before.
    Any suggestion will be very hepful...
    Thanks....

    I dont know if I truly understand your problem...
    For instance, when you place the url of your jsp you can add, at the end some parameters. For example:
    http://myserver/myapp/myjsp.jsp?MyParameter=C:\Temp\JavaTutorial.html
    In your JSP, you can place this code on a scriplet to get the value:
    String path = request.getParameter("MyParameter");
    Hope it helps.

  • How to run DOS command in Java environment?

    Can i run DOS command in Java environment?
    I did like this:
    Runtime r = Runtime.getRuntime();
    r.exec("cmd.exe");
    r.exec("set classpath=%CLASSPATH%;.\\tmp")
    but failed.
    However if I run the java command, it runs successfully.
    r.exec("javac Test.java");
    r.exec("java Test");
    how should I do so that i can run the DOS commands metioned above in Java Environment?
    thanks a lot.

    Have a look at http://www.javaworld.com/javaworld/jw-12-2000/jw-1229-traps.html
    This may help. I wonder if this is ok ?
    Runtime r= Runtime.getRuntime();
    r.exec("cmd.exe /C set classpath=%CLASSPATH%;.\\tmp\"");

  • How to pass a command line argument to the sequence?

    Hi,
    My GUI is written in VB.NET. I can read the command line argument in the GUI, using: Me.AxApplicationMgr.CommandLineArguments(). But I don't know how to pass it on to my sequence file which the GUI invokes. How do I read the command line argument from the sequence file?
    My purpose, is to have the same basic sequence execute different subsequences depending on starting conditions...
    I am using TestStand 3.0 with a VB.NET GUI, on Windows XP.
    I'd appreciate any help on the subject.
    Alan

    Hi Alan,
    One obvious way would be to add parameter(s) to the MainSequence and then modify the process model sequence file to use the new parameter(s) in the step "MainSequence Callback"  in either Single Pass or Test UUTs but I wouldn't recommend this approach.
    The sequence file to be run via the entry point can be found at "RunState.ProcessModelClient" and the lookup string to the MainSequence would be "RunState.ProcessModelClient.Data.Seq["MainSequence"] or .Seq[0] .
    Therefore you could quite easy use the SetVal method to setup a Local variable in the MainSequence of your Sequence File to receive the command line string.
    Also you could do this without altering the Process Model Sequence File by using the Callback Sequence ProcessSetup in your Sequence File.
    As an example.
    You have a string in your Locals of MainSequence called CmdLineStr.
    If you add the Callback Sequence ProcessSetup to your SequenceFile, then add an ActiveX Automation Adapter step which is setup for a PropertyObject and the reference is RunState.Caller.RunState.ProcessModel.Data.Seq[0].Locals.CmdLineStr.
    There is an extra RunState.Caller to the lookup string, that's because I am doing the work in a SubSequence of Entry Point Sequence.
    The method to use is SetValString and the parameters of the PropertyObject will be
    lookupString = ""
    options = 0 or 1
    newValue = where evey you have stored you command line string.
    Now when you run your sequence file you will find that the Locals.CmdLineStr will contain your parameter string.
    Hope this is of help to you.
    Regards
    Ray Farmer
    Regards
    Ray Farmer

  • How to call dos commands through HTMLDB buttons

    HI,
    How do i call DOS commands through HTMLDB buttons, or on any process?
    can anyone help me on this?
    THANKS!
    BROKEN

    This article explains how to execute shell commands from whitin pl/sql using java (in the database).
    http://www.oracle-base.com/articles/8i/ShellCommandsFromPLSQL.php
    It is for Oracle8i but should still work. This still looks like a good way to go.
    ~Dietmar.

  • How to pass a command into Telnet Play Script dynamically?

    I'd like to pass a command into Telnet Play Script dynamically. Could I do it?
    Thank you.

    Jim,
    I've attached a vi just to show how I send a command to my gateway using Telnet Write.vi. Actually this command changes speed on entered port of my gateway. Port number is changeable. I have question: could I send this command using Telnet Play Script.vi instead of Telnet Write.vi? If Yes - then How?
    Tank you
    Attachments:
    script1.vi ‏10 KB

  • How to execute dos command in Java program?

    In Perl, it has System(command) to call dos command.
    Does java have this thing?
    or any other way to execute dos command in java program?
    Because i must call javacto compile a file when the user inputed a java file name.

    Look in the Runtime class, it is implemented using the Singleton design pattern so you have to use the static method getRuntime to get its only instance, on that instance you can invoke methods like
    exec(String command) that will execute that command in a dos shell.
    Regards,
    Gerrit.

  • How to run dos command on java

    would java run the dos command ?
    if yes ~would you mind give me some example~please~

    ..or just use:
    Runtime.getRuntime().exec("cmd /c commandyouwanttouse");
    Hope it works!                                                                                                                                                                                               

  • How to pass SQL command parameter using OpenDocument

    Hi !
    I have a dynamic List of values configured in Business View manager, used across multiple reports.
    The data source for this LOV is a SQL Command which accepts a static parameter named stringParam. I need to pass this static parameter in the URL using OpenDocument command. How can I do this?
    I tried
    http://bobjdev/businessobjects/enterprise115/InfoView/scripts/opendocument.aspx?spath=[ReportFolder]&sDocName=WebReport.rpt&stype=rpt&lsSstringParam=ABC
    but it still prompts me to select the parameter. I need to avoid this prompt.
    Any help, please.

    Hi,
    I would recommend to take a look at the documentation in order to identify the correct syntax for your URL
    [http://help.sap.com/businessobject/product_guides/boexir31/en/xi3-1_url_reporting_opendocument_en.pdf]
    Regards,
    Shweta

  • How do run dos command from form

    Hi all,
    I need to run a file.bat (dos), someone can help me, please?
    I know the command HOST(..), but when execute the command exit a black window. Are there other command?
    Thank you
    Silvia

    Hello,
    I know the command HOST(..), but when execute the command exit a black window. Are there other command?Version Dependent.
    For less then or equal 6i version
    HOST('CMD /C C:\batch_file_name.bat');For the web based...
    The same above command will work for AS level. If you need on client side then
    CLIENT_HOST('CMD /C C:\batch_file_name.bat');-Ammad

  • How to pass a command string and  file content in a socket?

    socket = new Socket(host.getHostIp(), host.getFilePort());
    BufferedReader br = new BufferedReader(new InputStreamReader(new FileInputStream("c:/test.xls")));
    BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(socket.getOutputStream()));
    bw.write("this is my control command.\n");// *\n use to mark a line*
    String cur = null;
    while((cur =br.readLine())!=null){
         bw.write(cur);
         bw.newLine();
    br.close();
    bw.flush();
    bw.close();then,read from the socket:
    BufferedReader myIn = new BufferedReader(new InputStreamReader(_myProcessSocket.getInputStream()));
    String command = myIn.readLine();
    // read file
    BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(new FileOutputStream("d:/test.xls")));
    String cur = null;
    while ((cur = myIn .readLine()) != null) {
         bw.write(cur);
         bw.newLine();
    bw.flush();
    bw.close();
    myIn .close();I find d:/test.xls cannot read,the file is bad.The code below is the same:
         BufferedReader br = new BufferedReader(new InputStreamReader(new FileInputStream("c:/Ñз¢ÈÎÎñ¸ú×ÙÇåµ¥_V5.1.xls")));
                   BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(new FileOutputStream("c:/Ñз¢ÈÎÎñ¸ú×ÙÇåµ¥_V5.2.xls")));
                   String cur = null;
                   while ((cur = br.readLine()) != null) {
                        bw.write(cur);
                        bw.newLine();
                   bw.flush();
                   bw.close();
                   br.close();

    You should only get the OutputStream and InputStream once and wrap this in the data streams
    To send data -
    DataOutputStream dos = new DataOutputStram(socket.getOutputStream());
    dos.writeUTF("´ïµ½ddddd");
    dos.writeInt(lengthOfFile);
    // Now loop reading the  file bytes a buffer and a time and writing them
    // using
    dos.write(buffer, 0, bytesRead);To receive data-
    DataInputStream dis = new DataInputStream(socket.getInputStream());
    String valueSent = dis.readUTF(); // Will return "´ïµ½ddddd"
    int lengthofFile = dis.readInt();
    // Now loop reading the file bytes to a buffer until you have read all the bytes of the file.

  • How to run dos command in jsp

    hi all,
    i am running this command at command prompt
    like below
    java filename argument.
    ex: java validateuser user1
    it works fine at command prompt. and the same command i want to run in jsp
    so i tried like this
    Runtime x = Runtime.getRuntime().exec("java validateuser user1");
    whats happenning here is it just opening command promot of java.exe but its not running validateuser.
    any help will be greatly appreciated.
    advance thanks.

    why on earth are you trying to run java.exe on the command line through JSP?i think you misunderstand my question.
    i am not trying to run java.exe on through jsp.
    I am trying to run a validateuser user1 in jsp .
    Note:validateuser is a java file which take one argument.here in my scnerio user1 is the argument.

  • Running DOS command from JAVA

    Hi ,
    I would appreciate if anyone could tell me how to run DOS command such as "del" using JAVA language .Thank you.

    <steps onto soapbox>
    Surely for something like 'del' we should be advocating a non-OS specific method so we don't lose sight of Java's cross platform abilities.
    If it has to run an OS specific thing fine, but please look for a non OS specific solution first.
    <steps off soapbox>

Maybe you are looking for

  • Error in propagation -- ORA-02019

    Hi All, i have setup streams replications at db level and it is wroked fine for 1 day after that it has stopped working and when i checked in dba_propatation i am getting error like this SQL> select propagation_name, destination_dblink, status, error

  • How to create a password file for executing psadmin command to deploy portl

    how to create a password file for executing psadmin command to deploy portlet

  • Keyboard settings problem Java Studio Enterprise 8.1 on OpenSUSE 10.2

    I have of Sun Java Studio Enterprise 8.1 installed on OpenSUSE 10.2 x86-64 using KDE. I use Finnish keyboard, the same keyboard is used in Swedish, too. For some reason I haven't been able to use the FI/SE keyboard layout with the IDE. The keyboard b

  • Removing stickers from Yoga

    Anybody tried this? I hate "inspired by Intel", "Intel inside" and other crappy stickers. Last time when I was removing them from MSI laptop I stuck with dirty places after stickers. I wonder if Lenovo stickers can be removed without any problems? So

  • Order related intercompany billing scenarios

    Hi, Need suggestion for order related intercompany billing from project. The scenarios is as follows. There will be two diffenr company code under the controlling area of the project. Parent company will use resources from supplying company for execu