How to excute commands in DOS ?

I want to execute DOS commands like "shutdown -i" in my Java application but I'm not able to get it done.
I've used the method as follows but it does not work(does not throw any exceptions as well):
try
Process child=Runtime.getRuntime().exec("shutdown -i");
catch(Exception e)
e.printStackTrace();
Also plz. shed some light on how to execute commands with multiple parameters like:
attrib -s -h -r "*.*" /s /d

This forum is for info on helping make Java accessible to people with disabilities. I fear you won't get an answer to your question via this forum. I recommend you post your question to a different forum, such as the "Java Programming" forum

Similar Messages

  • How can i set the dos can compile and excute the jar file?please help?

    How can i set the dos prompt can compile my .java file and execute my jar file.

    Go to where you downloaded your Java SDK. Look around for a button labled "Installation." Click the button. Download the installation instructions. Read them. Then read them again.

  • How to excute a local file?

    Hi. Experts.
    I want to excute a file (like aaa.doc) when i click a file after uploading in alv.
    How to excute a local file?
    I used behind command
        lv_filename = ls_zdmt03-filenm.
        cl_wd_runtime_services=>attach_file_to_response(
           i_filename               = lv_filename
           i_content                = ls_zdmt03-filecontent
           i_mime_type              = ls_zdmt03-filetype
           i_in_new_window = abap_true
           i_inplace                = abap_true ).
    But do not excute one. just open a browser and quickly close a browser.
    Please help me.
    Thanks
    Regards.

    What do you mean by execute a file?  You say execute, but then in your example you list aaa.doc.  A word document doesn't need to be execute.  The cl_wd_runtime_services=>attach_file_to_response will download a file (like a word document) and the browser will open it in its default program.  Is that not what you want to happen?
    What kind of file do you actually have?  Is it on the server or the client?
    If you want to execute applications on the client machine, then you can consider the UI element ACFExecute - as of NetWeaver 7.0 Enhancement Package 1.

  • How to run command SQLLoader Oracle in c#

    Hello,
    How to run command SQLLoader Oracle in c#. I try my sourcode for run this SQLLoader, but nothing happen and error "No process is associated with this object.". Please tell me how i fix it. Thanks.
    This is my code:
    System.Diagnostics.Process process1;
    process1 = new System.Diagnostics.Process();
    process1.EnableRaisingEvents = false;
    string strCmdLine;
    strCmdLine = @"/C SQLLDR XL/secreat@O11G CONTROL=E:\APT\LoadXL.ctl";
    System.Diagnostics.Process.Start("CMD.exe", strCmdLine);
    process1.WaitForExit();
    process1.Close();

    jesperdj ,thanks:)
    actually,i am using eclipse to run my ant tasks programmatically,but I got trouble with the AntRunner class.it seems that i should config a proper classloader for it,but i just don't know how.please lend a hand:)thanks
    robin

  • How do I get to dos to show in the sidebar in Mail with OS X Lion?

    How do I view To Dos under Reminders along with Notes in the Sidebar in Mail with OS X Lion?

    See Use an album friendly view. After arranging things in order right/option click on the playlist title and click Copy to play order.
    tt2

  • Linux server(how to save command out put to another file. )

    hi all,
    i have Q ?
    how to save command out put to another file.
    Ex: #ps -ef
    that particular cmd output i need to save another file.
    is it possible ...if possible ..please let me know
    And how to save command history in Linux.

    df -h >> /oracle/output.log
    /oracle -- mount point name
    Regards
    Asif Kabir

  • How to implement command pattern into BC4J framework?

    How to implement command pattern into BC4J framework, Is BC4J just only suport AIDU(insert,update,delete,query) function? Could it support execute function like salary caculation in HR system or posting in GL(general ledger) system? May I create a java object named salaryCalc which use view objects to get the salary by employee and then write it to database?
    Thanks.

    BC4J makes it easy to support the command pattern, right out of the box.
    You can write a custom method on your application module class, then visit the application module wizard and see the "Client Methods" tab to select which custom methods should be exposed for invocation as task-specific commands by clients.
    BC4J is not only for Insert,Update,Delete style applications. It is a complete application framework that automates most of the typical things you need to do while building J2EE applications. You can have a read of my Simplifying J2EE and EJB Development Using BC4J whitepaper to read up on an overview of all the basic J2EE design patterns that the framework implements for you.
    Let us know if you have more specific questions on how to put the framework into practice.

  • Doubt in "FOR command in DOS"

    All,
    I have set of files starting with the name, e.g. xxx and the extension depends on the date. For example the extension of the current date is xxx.518. 5 is the month and 18 is the day of month.
    I am creating one application that would delete the xxx.* files depends on the retention days. If I give retention days as 10, it will keep 10 xxx.*(e.g. 508 to 518) files and delete remaining files.
    So I am using FOR command of DOS. I am using runtime.getRuntime to execute this.
    I am using
    (e.g.)
    FOR %%V in (pinpad.50?, pinpad.51?) do (command)
    Using this I can get only the files not to delete. But I want the filenames which needs to be deleted from the directory. (One option is there to give the range of all the files to delete in the SET. But it is some what difficult.)
    My question is
    Can we give get the filenames not specified in the IN SET (pinpad.50?, pinpad.51?) ?
    Is it possible ??
    namanc

    I agree with others, this should be done using Java...
    This said, you can use the following BATCH files to achieve your goal (not tested, sorry):
    BDELFILES.BAT
       rem TESTS AND DELETES FILES IF NEEDED
       rem
       FOR %%F in (*.*) call BDELFILE.BAT %%F
    BDELFILE.BAT
       rem TESTS AND DELETES A FILE IF NEEDED
       rem file name is in parameter 1
       rem
       set TODEL=1
       FOR %%F in (*.50? *.51?) do IF "%1" == "%%F" set TODEL=0
       IF "%%TODEL" == "1" DEL %%F

  • How to give command line arguments

    does anyone help me out in how to give command line arguments after run my program
    m using netbeans6.0.1

    If you want your program to take console input while it's running (as opposed to command line arguments, which are passed once, when you start your program), you can wrap a BufferdInputStream or a Scanner around System.in.
    [http://java.sun.com/docs/books/tutorial/essential/io/index.html]

  • How to run c   using dos box in mac

    I have installed dos box but have trouble finding how to open c++ using dos box. A blue screen of dos box appears what are we supposed to enter there to get in c++

    No XML required, but you must put the class into a package.
    Packages are folders with some files that identify whats in them, so you will end up with something like
    yourWebbApp/classes/yourPackage/yourClass

  • How to Excute the BW Roles

    Hi All,
           How to excute the BW Queries in portal, if any body knows procedure pls reply to me....
    Regards,
    Jagadish Babu Kanikanti.

    Hi Jagdish
    check system setting in portal for BW.
    or do it by following.
    Creating BW system in Portal
    From the portal top-level navigation, choose System Administration -> System Configuration -> System Landscape
    Navigate to Portal Content -> Your SAP Ssytem Folder i.e SAP BW
    Right-click on the SAP BW folder, then choose New -> System
    Select SAP system using dedicated application server
    from System Template
    Make the following entries for the BW system you want to connect to the Enterprise Portal
    System Name -
    SAP_BW
    System ID -
    Any ting u want like SAP_BW or SID of BW
    System ID Prefix -
    com.mycompany
    Master Language -
    English
    Description -
    NEXT -> Summary, review the options you selected for the new page.To make changes, choose Back to return to the appropriate screen. Then choose Next till you reach the Summary page, review, and choose Finish
    Choose Open the object for editing and choose OK
    The Property Editor iView will open
    Select Connector in the Property Category dropdown
    Enter the fields below according to your SAP system
    Application Host -
    IP Address of BW system or Host name ( FQDN required for SSO )
    SAP Client --- BW system client
    SAP System ID -
    SID of BW
    Server Port -
    3200 default for system number 00
    SAP System Number -
    00 or ur instance number
    System Type -
    SAP_BW
    NOW,
    Select User Management from the Property Category dropdown list
    Enter the fields below
    Logon Method -
    UIDPW
    User Mapping Type --- Admin,user
    Note -: IF u want to use SSO for BW system first selct above and test it with BW system if it's ok than change to following
    Logon Method -
    SAPLOGONTICKET
    User Mapping Type --- Admin,user
    choose SAVE.
    Select System Aliases in the Edit dropdown list. This opens the System Alias Editor
    In Alias, enter SAP_BW. Choose the Add button
    Choose Save to save your changes and close the page
    Connect With ITS
    For BW
    In Property Catalog, use the dropdown to select ITS.
    Set your SAP system properties according to Following
    ITS Description -
    Description
    ITS Host Name -
    Host name : Port for BW system
    If u want to use SSO use FQDN instead of host name
    ITS Path -
    /scripts/wgate
    ITS Protocol -
    http
    Save your settings.
    u can check its for BW by following
    Find a port for BW using IIS manager
    Administrator tools -> Internet Service Manager - >
    extend the HOST
    Find the site created for BW system same like SID of BW system -> right click -> Properties
    TCP Port -- this is used for ur BW system
    in IE http://host_for_its:Port_for_bw/scripts/wgate/webgui/!
    WAS for BW System
    Select Web Application Server (WAS) in the Property Category dropdown list
    WAS Description -
    BW WAS
    WAS Host Name -
    Host name : Port for BW system
    use FQDN for SSO
    WAS Path -
    /SAP/BW/Bex
    WAS Protocol -
    http
    Save ur entry.
    User Management For BW and EP
    Befor u start if u don't use SAP Secu lib during installation
    change the following
    system Administration -> System configuration -> Um configuration -> Direct editing
    find out follwoing
    ume.usermapping.unsecure=False
    change to
    ume.usermapping.unsecure=TRUE
    Save and restart portal server
    ther are so many option available for DATA source u have required doc for using that
    if u have any query for that msg me back
    Mapping Users in the Portal
    if u want to use UIDPW than user must be map to BW system
    go by following
    User Administration -> User Mapping
    select the user u want to map by serch or entering a name
    Choose the Alias for your backend system, for example SAP_BW
    Enter the user id and password for BW user
    save ur changes.
    SSO configuration
    make sure ur Portal ITS and BW WAS system belong to Same
    domain.
    i.e
    portal.mycompany.com
    its.mycompany.com
    bw.mycompany.com
    if not, u can do by creating a alias into host file for corresponding system
    for SSO follwoing parameter must be set in profile parameter using RZ10 in BW system
    login/accept_sso2_ticket -
    1
    login/create_sso2_ticket -
    1
    login/ticket_expiration_time --- desired value default 60
    now download the portal certificate form follwoing
    System administration -> System configuration -> Keystore
    Administration
    donload verify.der file save it it's like verify.der.zip
    extract it than u can get verify.der
    now in BW system using trans. STRUSTSSO2
    in the certificate section choose import certificate
    choose the file tab enter the path of the portal's verify.der file
    set the file format to DER coded
    in the trust manager choose ADD to PSE and Choose
    ADD to ACL
    in the dialog box enter the portal system's id (SID) and client
    by default portla system ID is the common name (CN) and client is 000
    save ur entry and restart the BW server
    this are the basci configuration if u have any query related to it msg me back
    regards,
    kaushal

  • How to get command history with timestamp ?

    how to get command history with timestamp ?

    If you are using bash:
    HISTTIMEFORMAT If this variable is set and not null, its value is used as a format string for strftime(3) to print the time stamp associated with each history entry displayed by the history builtin. If this variable is set, time stamps are written to the history file so they may be preserved across shell sessions.
    [SunOS 5.10/bash] [email protected]:/etc/ftpd
    # HISTTIMEFORMAT="%h/%m - %H:%M:%S ";export HISTTIMEFORMAT;history
        1  Aug/08 - 19:07:52 chmod a+rwx /root
        2  Aug/08 - 19:07:52 ll /
        3  Aug/08 - 19:07:52 tail -f /root/mylog.log
        4  Aug/08 - 19:07:52 vi /usr/dt/bin/Xsession
        5  Aug/08 - 19:07:52 cat /root/mylog.log
        6  Aug/08 - 19:07:52 ls /export/home/p661210/.dt
        7  Aug/08 - 19:07:52 ls -la  /export/home/p661210/.dt
        8  Aug/08 - 19:07:52 cat  /export/home/p661210/.dt/errorlog
        9  Aug/08 - 19:07:52 vi /usr/dt/config/C/sys.dtwmrc
       10  Aug/08 - 19:07:52 ls
       11  Aug/08 - 19:07:52 cat Xresources.jds
       12  Aug/08 - 19:07:52 vi /usr/dt
    [SunOS 5.10/bash] [email protected]:/etc/ftpd
    [SunOS 5.8/bash] root@wgls03:/root
    # HISTTIMEFORMAT="%h/%m - %H:%M:%S ";export HISTTIMEFORMAT;history
        1  Jul/07 - 09:02:21 vi /etc/vfstab
        2  Jul/07 - 09:02:21 mount /store
        3  Jul/07 - 09:02:21 cd /store/bnz
        4  Jul/07 - 09:02:21 ls
        5  Jul/07 - 09:02:21 ./BNZ_installBaseSoftware
        6  Jul/07 - 09:02:21 find /usr -name gunzipCheers,
    Andreas

  • How to issue commands c shell

    hi buddy.....
    i need help again.....
    how to issue commands c shell in Linux(Ubuntu 9.10) for example:
    *% source ./.login*

    how to issue commands c shell in Linux(Ubuntu 9.10) for example:by default C shell is not included in Ubuntu (see below)
    bcm@bcm-laptop:~$ csh
    The program 'csh' can be found in the following packages:
    * csh
    * tcsh
    Try: sudo apt-get install <selected package>
    csh: command not found
    bcm@bcm-laptop:~$ uname -a
    Linux bcm-laptop 2.6.31-19-generic #56-Ubuntu SMP Thu Jan 28 01:26:53 UTC 2010 i686 GNU/Linuxpost results of following commands
    env | sort

  • How to execute a unix/dos command in Java

    Hi,
    I want to execute dos/unix commands in my java program. Can anyone tell me how to do this. Say I want to restart my httpd daemon using the command: "service httpd restart" or test my httpd.conf file using the command "testparn"
    thanks in advance
    Hugo Hendriks

    hallo,
    test this:
    Process p = Runtime.getRuntime().exec(Your_Programm);
    p.waitFor();
    LineNumberReader lnr = new LineNumberReader(new InputStreamReader(p.getInputStream()));
    Your_Programm must be a shellscript. regard that your java programm must have the right to start the httpd!
    Carsten Bluetner

  • How to use Runtime execute DOS command?

    Hello,
    I can not use Runtime class execuste Dos command such as copy and dir.
    Is there any suggestion?
    Thanks in advance.

    execute the command with cmd /c (winNT, win2k) or command /c (win9x). Example: "cmd /c dir"
    details: http://www.javaworld.com/javaworld/jw-12-2000/jw-1229-traps.html

Maybe you are looking for

  • Creation of Purchase Requisition  for each line item of a SO

    Hi everybody.. My SO has 2 materials which is to be purchased from two different vendors. If i create SO with2 different materials, only one PR generated. I want to generate two different PR to create two PO. Dhana Edited by: dhanasekharan thyagaraja

  • Is it possible to propose another default file name in ALV Excel Export?

    Hello All, I have a problem while exporting to Excel from the WD ALV. The whole process works fine, the problem occurs when the user wants to open (without saving) multiple exported Excel documents at the same time. In this case he gets an error mess

  • Export / Import Mapping into Different Project in same repository

    Hi, Any one tell me, its this possible? We have one repository ( OWB 10 R2 ) and two projects named dev_project and test_project. We want to copy or (export /import) the mappings from dev_project to test_project, how to do this? It seems export and i

  • Enhancement for Transaction IW31

    Hi All,   Is there a userexit or BADI or Enhancement point to update the Planned cost or the Estimated cost in transaction IW31. Please let me know a way to change the planned cost or the extimated cost. Thanks, Rajesh.

  • Republish web application on from Workshop 9.2

    Hi, we migrated our application from Weblogic 8.1 to Weblogic 9.2. Now, we have trouble when we try to debug our web application after a modification. There is no problem when changin a jsp file, but as soon as we change a .java file like a PageFlowC