Running CMD command in PS

In PS2, I always use cmd.exe /C to run DOS commands.
However, I ran into this scenario:
The first try, using cmd.exe /C, failed with the above error.
The second try, running the command directly, was successful.
Anyone can explain why?
Thanks.

PowerShell will strip the quotation marks from your string when it gets passed to cmd.exe, and you have some special characters in that password which will cause problems if it's not quoted.  In this case, it's the > character 4 characters into the
password that's ending the command.  It tries to set a 4-character password, and sends stdout to a goofy file name starting with 3A.
There's also a problem with the backticks in the password, which will also be removed by PowerShell when it parses a double-quoted string.  Even in your second command, you'll find that the password doesn't work if you try to type it with the backticks
included.
As a simple workaround, wrap the password in a set of single quotes (leaving the double quotes included) if you want to pass it to cmd.exe for some reason.  This will also prevent PowerShell from using the backtick as an escape character:
cmd.exe /C net user Administrator '"B?E;>3A`w+8D6z^G2T`Y3K1"'
If you want to just run net user from PowerShell, I'd probably put the password into a single-quoted here-string to avoid any problems with escaping characters:
$password = @'
B?E;>3A`w+8D6z^G2T`Y3K1
net user Administrator $password

Similar Messages

  • PowerShell run cmd command

    Hello,
    I am very new to PowerShell scripting.
    Suddenly we want to move our code from VB script to PS, and i don't have much idea how to wrote this statement in PS.
    wshShell.Run(myCommand,0,false)
    Requirement: myCommand is IBM bat command (ibmdisrv) and its arguments, and want to run in background (So if I close PS screen or log off the server, still command run as a process).
    Thanks in advance.

    Thanks For you response, 
    Still not getting many things, I have tried Start-Job but not working with me, By hook and crook my command working but it is not going to background or silent, always popup cmd promt.
    Here it is VB script
    Set wshShell = WScript.CreateObject("WSCript.shell")
    var strCommand = "cmd.exe /K """"" & IDI_HOME & "\ibmdisrv"" -c""" & IDI_CONFIG_DIR & "\" & IDI_CONFIG_FILE & """ -r""" & IDI_ASSEMBLYLINES
    ' -c for config file and -r for assemlyLine flow
    cmdResponse = wshShell.Run(strCommand,0,false)
    Now want to PS (I tried but not worked)
    $commandLine = '& "$TDI_INSTALL_HOME\ibmdisrv" -c "$TDI_CONFIG_FILE" -r "$TDI_ASSEMBLYLINE"';
    Start-Job -ScriptBlock {Invoke-Expression -Command:$commandLine}}
    Thanks

  • Running CMD command from process.exec

    I've been chopping this code up so forgive me if this is a mess, however I cannot figure out why this command simply will not work. It never seems to attempt to sign the jar files. I've also tried to sign the jar file by using an output stream. I can run the System.out of the payload from the CMD and it works fine.
    When this method is executed it seems to loop over like nothing is happening.
    private void signJar(String jarPath)
                   String payload = "\"c:\\program files\\java\\jdk1.6.0_17\\bin\\jarsigner.exe\" -keystore \"" + ksPath + "\" -storepass " + ksPW + " \"" + jarPath + "\" " + ksAlias;
                   try {
                        Process proc = Runtime.getRuntime ().exec("cmd /c " + payload);
                        InputStream inputstream = proc.getInputStream();
                        InputStream errorstream = proc.getErrorStream();
                        InputStreamReader inputstreamreader = new InputStreamReader(inputstream);
                        InputStreamReader errorstreamreader = new InputStreamReader(errorstream);
                        BufferedReader inputreader = new BufferedReader(inputstreamreader);
                        BufferedReader errorreader = new BufferedReader(errorstreamreader);
                        while ((line = inputreader.readLine()) != null) {
                             d.asyncExec(new Runnable() {
                                  public void run(){
                        l.setText(line + "\n" + l.getText());
                        while ((line = errorreader.readLine()) != null) {
                             d.asyncExec(new Runnable() {
                                  public void run(){
                             l.setText(line + "\n" + l.getText());
                        errorreader.close();
                        inputreader.close();
                        return;
                        catch(IOException e)
                             e.printStackTrace();
                             return;
              }

    sabre150 wrote:
    You probably have a deadlock since your code falls for at least 2 of the traps described in the 4 sections of [http://www.javaworld.com/javaworld/jw-12-2000/jw-1229-traps.html|http://www.javaworld.com/javaworld/jw-12-2000/jw-1229-traps.html].
    Thanks, I checked this out and decided to implement one of the methods he had, however, now I am getting an illegal argument exception. I think it is because of my payload, but I am not sure how to fix it. I know everything is formatted properly to input it in the console manually.
    private void signJar(String jarPath)
                   String payload = "\"c:\\program files\\java\\jdk1.6.0_17\\bin\\jarsigner.exe\" -keystore \"" + ksPath + "\" -storepass " + ksPW + " \"" + jarPath + "\" " + ksAlias;
                   String cmds[] = {"cmd","/c",payload};
                   if (cmds.length < 1)
                     System.out.println("USAGE: java GoodWindowsExec <cmd>");
                     System.exit(1);
                 try
                     String[] cmd = new String[3];
                         cmd[0] = "cmd.exe" ;
                         cmd[1] = "/C" ;
                         cmd[2] = cmds[2];
                     Runtime rt = Runtime.getRuntime();
                     System.out.println("Execing " + cmd[0] + " " + cmd[1]
                                        + " " + cmd[2]);
                     Process proc = rt.exec(cmd);
                     // any error message?
                     StreamGobbler errorGobbler = new
                         StreamGobbler(proc.getErrorStream(), "ERROR");           
                     // any output?
                     StreamGobbler outputGobbler = new
                         StreamGobbler(proc.getInputStream(), "OUTPUT");
                     // kick them off
                     errorGobbler.start();
                     outputGobbler.start();
                     // any error???
                     int exitVal = proc.waitFor();
                     System.out.println("ExitValue: " + exitVal);       
                 } catch (Throwable t)
                     t.printStackTrace();
              }Updated with different code still same error
    EDIT: I should pay closer attention and stop trying to copy and paste code. I see where he says you can't use it like the command line...

  • Running cmd commands through java

    Hi,
    I am trying to run few dos commands through java using Runtime.exec("command") but I am getting following error
    commmand is cd D:\CodeMerge\A\
    java.io.IOException: CreateProcess: cd.. error=2
    at java.lang.Win32Process.create(Native Method)
    at java.lang.Win32Process.<init>(Unknown Source)
    at java.lang.Runtime.execInternal(Native Method)
    at java.lang.Runtime.exec(Unknown Source)
    at java.lang.Runtime.exec(Unknown Source)
    at java.lang.Runtime.exec(Unknown Source)
    at java.lang.Runtime.exec(Unknown Source)
    at createDirectory.main(createDirectory.java:24)
    Basically what I am looking for is this:
    1) My program is in D:\Amit\RM
    2) I want to get out to D:\ go to CodeMerge\A\.
    3) Create folder with curretn date as name of the folder
    Hence I am doing
    rTime.exec("cd../..");
    rTime.exec("cd D:\CodeMerge\A\");
    rTime.exec("mkdir "+date);
    Can anybody tell me why I am getting this error
    Jounty

    U can run either DOS Commands or UNIX Commands thru the following Java Program
    Written By BalaNagaraju Malisetti
    contact: [email protected]
    import java.io.*;
    public class RunBdiff
    public static String rununixcmd(String v_prev_path,String v_curr_path,String v_delta_path,String v_beg,String v_len)
    String s = null;
    FileOutputStream fos;
    DataOutputStream dos;
    try
    int v_int_beg = Integer.parseInt(v_beg);
    int v_int_len=Integer.parseInt(v_len);
    int v_int_end=(v_int_beg+v_int_len)-1;
    String v_pos1=String.valueOf((v_int_beg+2));
    String v_pos2=String.valueOf((v_int_end+2));
    String cmd1 = "bdiff ";
    String cmd2=v_prev_path;
    String cmd3=" ";
    String cmd4=v_curr_path;
    String cmd5="| grep '^>'";
    String cmd6="| cut -c";
    String cmd7=v_pos1+"-"+v_pos2;
    String cmd8="| sort ";
    String cmd9="| uniq ";
    String cmd=cmd1+cmd2+cmd3+cmd4+cmd5+cmd6+cmd7+cmd8+cmd9;
    String[] commands = {"/bin/csh","-c",cmd}; //in Unix
    //String[] commands = {"cmd.exe","-c",cmd}; //in Windows
    Process p = Runtime.getRuntime().exec(commands);
    BufferedReader stdInput = new BufferedReader(new InputStreamReader(p.getInputStream()));
    BufferedReader stdError = new BufferedReader(new InputStreamReader(p.getErrorStream()));
    // read the output from the command
    File file = new File(v_delta_path);
    fos = new FileOutputStream(file);
    dos=new DataOutputStream(fos);
    //Writing the output of bdiff command to Delta File
    while ((s = stdInput.readLine()) != null)
    dos.writeChars(s);
    //Return Error Message to Calling Procedure
    while ((s = stdError.readLine()) != null)
    return s;
    return s;
    catch (IOException e)
    return String.valueOf(e);
    public static void main(String args[])
    String msg=rununixcmd("/home/g_anil/MS_ADDRESS1.dat","/home/g_anil/MS_ADDRESS2.dat","/home/g_anil/MS_ADDRESS_DELTA.dat","1","9");
    **************************************************************************************************************************************

  • Process.Start - getting different output when running command using this method than I am if I run same command in CMD prompt

    Hi
    Creating an application to analyze .dmp files - all working well except this odd issue
    If I open command prompt and enter this command:-
    kd -z C:\Windows\MiniDump\042414-24632-01.dmp -c "!analyze -v"
    Then it works and shows me all the output I need (shown at bottom of post)
    If I run same command in VB.net using following code - then it doesn't give the same output - the bits I need at the end created by the !analyze -v switch don't appear
    Any ideas why it is not seeing the switch correctly - setting a breakpoint and checking contents of startinfo seems to be showing correct cmd line i.e. "kd -z C:\windows\minidump\042414-24632-01.dmp -c "!analyze –v;q""
    Dim myprocess As New Process()
    myprocess.StartInfo.FileName = "C:\Program Files (x86)\Windows Kits\8.1\Debuggers\x86\kd"
    myprocess.StartInfo.Arguments = "-z C:\windows\minidump\042414-24632-01.dmp -c ""!analyze –v;q"""
    myprocess.StartInfo.UseShellExecute = False
    myprocess.StartInfo.RedirectStandardOutput = True
    myprocess.StartInfo.CreateNoWindow = True
    myprocess.Start()
    TextBox1.AppendText(myprocess.StandardOutput.ReadToEnd())
    Output when run from cmd prompt:-
    C:\Program Files (x86)\Windows Kits\8.1\Debuggers\x86>kd -z C:\Windows\MiniDump\042414-24632-01.dmp -c "!analyze -v;q"
    Microsoft (R) Windows Debugger Version 6.3.9600.17298 X86
    Copyright (c) Microsoft Corporation. All rights reserved.
    Loading Dump File [C:\Windows\MiniDump\042414-24632-01.dmp]
    Mini Kernel Dump File: Only registers and stack trace are available
    Symbol search path is: *** Invalid ***
    * Symbol loading may be unreliable without a symbol search path. *
    * Use .symfix to have the debugger choose a symbol path. *
    * After setting your symbol path, use .reload to refresh symbol locations. *
    Executable search path is:
    * Symbols can not be loaded because symbol path is not initialized. *
    * The Symbol Path can be set by: *
    * using the _NT_SYMBOL_PATH environment variable. *
    * using the -y <symbol_path> argument when starting the debugger. *
    * using .sympath and .sympath+ *
    Unable to load image \SystemRoot\system32\ntkrnlpa.exe, Win32 error 0n2
    *** WARNING: Unable to verify timestamp for ntkrnlpa.exe
    *** ERROR: Module load completed but symbols could not be loaded for ntkrnlpa.exe
    Windows 7 Kernel Version 7601 (Service Pack 1) MP (4 procs) Free x86 compatible
    Product: WinNt, suite: TerminalServer SingleUserTS
    Built by: 7601.18205.x86fre.win7sp1_gdr.130708-1532
    Machine Name:
    Kernel base = 0x82e3e000 PsLoadedModuleList = 0x82f874d0
    Debug session time: Thu Apr 24 13:36:18.672 2014 (UTC + 1:00)
    System Uptime: 0 days 0:00:38.703
    * Symbols can not be loaded because symbol path is not initialized. *
    * The Symbol Path can be set by: *
    * using the _NT_SYMBOL_PATH environment variable. *
    * using the -y <symbol_path> argument when starting the debugger. *
    * using .sympath and .sympath+ *
    Unable to load image \SystemRoot\system32\ntkrnlpa.exe, Win32 error 0n2
    *** WARNING: Unable to verify timestamp for ntkrnlpa.exe
    *** ERROR: Module load completed but symbols could not be loaded for ntkrnlpa.exe
    Loading Kernel Symbols
    Loading User Symbols
    Loading unloaded module list
    ************* Symbol Loading Error Summary **************
    Module name Error
    ntkrnlpa The system cannot find the file specified
    You can troubleshoot most symbol related issues by turning on symbol loading diagnostics (!sym noisy) and repeating the
    command that caused symbols to be loaded.
    You should also verify that your symbol search path (.sympath) is correct.
    * Bugcheck Analysis *
    Use !analyze -v to get detailed debugging information.
    BugCheck 50, {afa99150, 0, 88c557d7, 0}
    *** WARNING: Unable to verify timestamp for mssmbios.sys
    *** ERROR: Module load completed but symbols could not be loaded for mssmbios.sys
    *** WARNING: Unable to verify timestamp for mfehidk.sys
    *** ERROR: Module load completed but symbols could not be loaded for mfehidk.sys
    *** WARNING: Unable to verify timestamp for HipShieldK.sys
    *** ERROR: Module load completed but symbols could not be loaded for HipShieldK.sys
    ***** Kernel symbols are WRONG. Please fix symbols to do analysis.
    *** Either you specified an unqualified symbol, or your debugger ***
    *** doesn't have full symbol information. Unqualified symbol ***
    *** resolution is turned off by default. Please either specify a ***
    *** fully qualified symbol module!symbolname, or enable resolution ***
    *** of unqualified symbols by typing ".symopt- 100". Note that ***
    *** enabling unqualified symbol resolution with network symbol ***
    *** server shares in the symbol path may cause the debugger to ***
    *** appear to hang for long periods of time when an incorrect ***
    *** symbol name is typed or the network symbol server is down. ***
    *** For some commands to work properly, your symbol path ***
    *** must point to .pdb files that have full type information. ***
    *** Certain .pdb files (such as the public OS symbols) do not ***
    *** contain the required information. Contact the group that ***
    *** provided you with these symbols if you need this command to ***
    *** work. ***
    *** Type referenced: nt!_KPRCB ***
    *** Either you specified an unqualified symbol, or your debugger ***
    *** doesn't have full symbol information. Unqualified symbol ***
    *** resolution is turned off by default. Please either specify a ***
    *** fully qualified symbol module!symbolname, or enable resolution ***
    *** of unqualified symbols by typing ".symopt- 100". Note that ***
    *** enabling unqualified symbol resolution with network symbol ***
    *** server shares in the symbol path may cause the debugger to ***
    *** appear to hang for long periods of time when an incorrect ***
    *** symbol name is typed or the network symbol server is down. ***
    *** For some commands to work properly, your symbol path ***
    *** must point to .pdb files that have full type information. ***
    *** Certain .pdb files (such as the public OS symbols) do not ***
    *** contain the required information. Contact the group that ***
    *** provided you with these symbols if you need this command to ***
    *** work. ***
    *** Type referenced: nt!_KPRCB ***
    *** Either you specified an unqualified symbol, or your debugger ***
    *** doesn't have full symbol information. Unqualified symbol ***
    *** resolution is turned off by default. Please either specify a ***
    *** fully qualified symbol module!symbolname, or enable resolution ***
    *** of unqualified symbols by typing ".symopt- 100". Note that ***
    *** enabling unqualified symbol resolution with network symbol ***
    *** server shares in the symbol path may cause the debugger to ***
    *** appear to hang for long periods of time when an incorrect ***
    *** symbol name is typed or the network symbol server is down. ***
    *** For some commands to work properly, your symbol path ***
    *** must point to .pdb files that have full type information. ***
    *** Certain .pdb files (such as the public OS symbols) do not ***
    *** contain the required information. Contact the group that ***
    *** provided you with these symbols if you need this command to ***
    *** work. ***
    *** Type referenced: nt!_KPRCB ***
    Probably caused by : mfehidk.sys ( mfehidk+377d7 )
    Followup: MachineOwner
    1: kd> kd: Reading initial command '!analyze -v;q'
    * Bugcheck Analysis *
    PAGE_FAULT_IN_NONPAGED_AREA (50)
    Invalid system memory was referenced. This cannot be protected by try-except,
    it must be protected by a Probe. Typically the address is just plain bad or it
    is pointing at freed memory.
    Arguments:
    Arg1: afa99150, memory referenced.
    Arg2: 00000000, value 0 = read operation, 1 = write operation.
    Arg3: 88c557d7, If non-zero, the instruction address which referenced the bad memory
    address.
    Arg4: 00000000, (reserved)
    Debugging Details:
    ***** Kernel symbols are WRONG. Please fix symbols to do analysis.
    *** Either you specified an unqualified symbol, or your debugger ***
    *** doesn't have full symbol information. Unqualified symbol ***
    *** resolution is turned off by default. Please either specify a ***
    *** fully qualified symbol module!symbolname, or enable resolution ***
    *** of unqualified symbols by typing ".symopt- 100". Note that ***
    *** enabling unqualified symbol resolution with network symbol ***
    *** server shares in the symbol path may cause the debugger to ***
    *** appear to hang for long periods of time when an incorrect ***
    *** symbol name is typed or the network symbol server is down. ***
    *** For some commands to work properly, your symbol path ***
    *** must point to .pdb files that have full type information. ***
    *** Certain .pdb files (such as the public OS symbols) do not ***
    *** contain the required information. Contact the group that ***
    *** provided you with these symbols if you need this command to ***
    *** work. ***
    *** Type referenced: nt!_KPRCB ***
    *** Either you specified an unqualified symbol, or your debugger ***
    *** doesn't have full symbol information. Unqualified symbol ***
    *** resolution is turned off by default. Please either specify a ***
    *** fully qualified symbol module!symbolname, or enable resolution ***
    *** of unqualified symbols by typing ".symopt- 100". Note that ***
    *** enabling unqualified symbol resolution with network symbol ***
    *** server shares in the symbol path may cause the debugger to ***
    *** appear to hang for long periods of time when an incorrect ***
    *** symbol name is typed or the network symbol server is down. ***
    *** For some commands to work properly, your symbol path ***
    *** must point to .pdb files that have full type information. ***
    *** Certain .pdb files (such as the public OS symbols) do not ***
    *** contain the required information. Contact the group that ***
    *** provided you with these symbols if you need this command to ***
    *** work. ***
    *** Type referenced: nt!_KPRCB ***
    *** Either you specified an unqualified symbol, or your debugger ***
    *** doesn't have full symbol information. Unqualified symbol ***
    *** resolution is turned off by default. Please either specify a ***
    *** fully qualified symbol module!symbolname, or enable resolution ***
    *** of unqualified symbols by typing ".symopt- 100". Note that ***
    *** enabling unqualified symbol resolution with network symbol ***
    *** server shares in the symbol path may cause the debugger to ***
    *** appear to hang for long periods of time when an incorrect ***
    *** symbol name is typed or the network symbol server is down. ***
    *** For some commands to work properly, your symbol path ***
    *** must point to .pdb files that have full type information. ***
    *** Certain .pdb files (such as the public OS symbols) do not ***
    *** contain the required information. Contact the group that ***
    *** provided you with these symbols if you need this command to ***
    *** work. ***
    *** Type referenced: nt!_KPRCB ***
    ADDITIONAL_DEBUG_TEXT:
    You can run '.symfix; .reload' to try to fix the symbol path and load symbols.
    MODULE_NAME: mfehidk
    FAULTING_MODULE: 82e3e000 nt
    DEBUG_FLR_IMAGE_TIMESTAMP: 4d2e1e3e
    READ_ADDRESS: GetPointerFromAddress: unable to read from 00000000
    GetPointerFromAddress: unable to read from 00000000
    unable to get nt!MmSpecialPoolStart
    unable to get nt!MmSpecialPoolEnd
    unable to get nt!MmPagedPoolEnd
    unable to get nt!MmNonPagedPoolStart
    unable to get nt!MmSizeOfNonPagedPoolInBytes
    afa99150
    FAULTING_IP:
    mfehidk+377d7
    88c557d7 0fb70c06 movzx ecx,word ptr [esi+eax]
    MM_INTERNAL_CODE: 0
    CUSTOMER_CRASH_COUNT: 1
    DEFAULT_BUCKET_ID: WIN7_DRIVER_FAULT
    BUGCHECK_STR: 0x50
    CURRENT_IRQL: 0
    ANALYSIS_VERSION: 6.3.9600.17298 (debuggers(dbg).141024-1500) x86fre
    LAST_CONTROL_TRANSFER: from 82e7eaa8 to 82ecb879
    STACK_TEXT:
    WARNING: Stack unwind information not available. Following frames may be wrong.
    ad0baf90 82e7eaa8 00000000 afa99150 00000000 nt+0x8d879
    ad0bafa8 88c557d7 badb0d00 00000000 88c4ceb0 nt+0x40aa8
    ad0bb040 88c4f97d 001a99b0 afa91000 00000000 mfehidk+0x377d7
    ad0bb090 88c52b16 00770220 ad0bb0fc 00000010 mfehidk+0x3197d
    ad0bb0bc 98d5fb73 ae770220 ad0bb0fc 00000010 mfehidk+0x34b16
    ad0bb140 98d5fc43 ae738c30 98d6b62a aace7220 HipShieldK+0xb73
    ad0bb168 98d6b882 ad0bb19c 00000000 98d77b44 HipShieldK+0xc43
    ad0bb1b8 98d631a9 00000bd4 0000102c ad0bb208 HipShieldK+0xc882
    ad0bb330 88c47795 00000bd4 0000102c ad0bb401 HipShieldK+0x41a9
    ad0bb400 88c22b57 0000102c ad0bb460 85b3dee0 mfehidk+0x29795
    ad0bb41c 88c232c6 ad0bb430 0000000c 8c4b6ce0 mfehidk+0x4b57
    ad0bb43c 830a5acb adb6b9b8 0000102c ad0bb460 mfehidk+0x52c6
    ad0bb4f4 830adaf8 adb16030 01b6b9b8 ad0bb550 nt+0x267acb
    ad0bbc00 82e7b8c6 038ae710 038ae6ec 02000000 nt+0x26faf8
    ad0bbc34 77a470f4 badb0d00 038ae3dc 00000000 nt+0x3d8c6
    ad0bbc38 badb0d00 038ae3dc 00000000 00000000 0x77a470f4
    ad0bbc3c 038ae3dc 00000000 00000000 00000000 0xbadb0d00
    ad0bbc40 00000000 00000000 00000000 00000000 0x38ae3dc
    STACK_COMMAND: kb
    FOLLOWUP_IP:
    mfehidk+377d7
    88c557d7 0fb70c06 movzx ecx,word ptr [esi+eax]
    SYMBOL_STACK_INDEX: 2
    SYMBOL_NAME: mfehidk+377d7
    FOLLOWUP_NAME: MachineOwner
    IMAGE_NAME: mfehidk.sys
    BUCKET_ID: WRONG_SYMBOLS
    FAILURE_BUCKET_ID: WRONG_SYMBOLS
    ANALYSIS_SOURCE: KM
    FAILURE_ID_HASH_STRING: km:wrong_symbols
    FAILURE_ID_HASH: {70b057e8-2462-896f-28e7-ac72d4d365f8}
    Followup: MachineOwner
    quit:
    output when run in my app:-
    Microsoft (R) Windows Debugger Version 6.3.9600.17298 X86
    Copyright (c) Microsoft Corporation. All rights reserved.
    Loading Dump File [C:\Windows\MiniDump\042414-24632-01.dmp]
    Mini Kernel Dump File: Only registers and stack trace are available
    Symbol search path is: *** Invalid ***
    * Symbol loading may be unreliable without a symbol search path. *
    * Use .symfix to have the debugger choose a symbol path. *
    * After setting your symbol path, use .reload to refresh symbol locations. *
    Executable search path is:
    * Symbols can not be loaded because symbol path is not initialized. *
    * The Symbol Path can be set by: *
    * using the _NT_SYMBOL_PATH environment variable. *
    * using the -y <symbol_path> argument when starting the debugger. *
    * using .sympath and .sympath+ *
    Unable to load image \SystemRoot\system32\ntkrnlpa.exe, Win32 error 0n2
    *** WARNING: Unable to verify timestamp for ntkrnlpa.exe
    *** ERROR: Module load completed but symbols could not be loaded for ntkrnlpa.exe
    Windows 7 Kernel Version 7601 (Service Pack 1) MP (4 procs) Free x86 compatible
    Product: WinNt, suite: TerminalServer SingleUserTS
    Built by: 7601.18205.x86fre.win7sp1_gdr.130708-1532
    Machine Name:
    Kernel base = 0x82e3e000 PsLoadedModuleList = 0x82f874d0
    Debug session time: Thu Apr 24 13:36:18.672 2014 (UTC + 1:00)
    System Uptime: 0 days 0:00:38.703
    * Symbols can not be loaded because symbol path is not initialized. *
    * The Symbol Path can be set by: *
    * using the _NT_SYMBOL_PATH environment variable. *
    * using the -y <symbol_path> argument when starting the debugger. *
    * using .sympath and .sympath+ *
    Unable to load image \SystemRoot\system32\ntkrnlpa.exe, Win32 error 0n2
    *** WARNING: Unable to verify timestamp for ntkrnlpa.exe
    *** ERROR: Module load completed but symbols could not be loaded for ntkrnlpa.exe
    Loading Kernel Symbols
    Loading User Symbols
    Loading unloaded module list
    ************* Symbol Loading Error Summary **************
    Module name Error
    ntkrnlpa The system cannot find the file specified
    You can troubleshoot most symbol related issues by turning on symbol loading diagnostics (!sym noisy) and repeating the
    command that caused symbols to be loaded.
    You should also verify that your symbol search path (.sympath) is correct.
    * Bugcheck Analysis *
    Use !analyze -v to get detailed debugging information.
    BugCheck 50, {afa99150, 0, 88c557d7, 0}
    *** WARNING: Unable to verify timestamp for mssmbios.sys
    *** ERROR: Module load completed but symbols could not be loaded for mssmbios.sys
    *** WARNING: Unable to verify timestamp for mfehidk.sys
    *** ERROR: Module load completed but symbols could not be loaded for mfehidk.sys
    *** WARNING: Unable to verify timestamp for HipShieldK.sys
    *** ERROR: Module load completed but symbols could not be loaded for HipShieldK.sys
    ***** Kernel symbols are WRONG. Please fix symbols to do analysis.
    *** Either you specified an unqualified symbol, or your debugger ***
    *** doesn't have full symbol information. Unqualified symbol ***
    *** resolution is turned off by default. Please either specify a ***
    *** fully qualified symbol module!symbolname, or enable resolution ***
    *** of unqualified symbols by typing ".symopt- 100". Note that ***
    *** enabling unqualified symbol resolution with network symbol ***
    *** server shares in the symbol path may cause the debugger to ***
    *** appear to hang for long periods of time when an incorrect ***
    *** symbol name is typed or the network symbol server is down. ***
    *** For some commands to work properly, your symbol path ***
    *** must point to .pdb files that have full type information. ***
    *** Certain .pdb files (such as the public OS symbols) do not ***
    *** contain the required information. Contact the group that ***
    *** provided you with these symbols if you need this command to ***
    *** work. ***
    *** Type referenced: nt!_KPRCB ***
    *** Either you specified an unqualified symbol, or your debugger ***
    *** doesn't have full symbol information. Unqualified symbol ***
    *** resolution is turned off by default. Please either specify a ***
    *** fully qualified symbol module!symbolname, or enable resolution ***
    *** of unqualified symbols by typing ".symopt- 100". Note that ***
    *** enabling unqualified symbol resolution with network symbol ***
    *** server shares in the symbol path may cause the debugger to ***
    *** appear to hang for long periods of time when an incorrect ***
    *** symbol name is typed or the network symbol server is down. ***
    *** For some commands to work properly, your symbol path ***
    *** must point to .pdb files that have full type information. ***
    *** Certain .pdb files (such as the public OS symbols) do not ***
    *** contain the required information. Contact the group that ***
    *** provided you with these symbols if you need this command to ***
    *** work. ***
    *** Type referenced: nt!_KPRCB ***
    *** Either you specified an unqualified symbol, or your debugger ***
    *** doesn't have full symbol information. Unqualified symbol ***
    *** resolution is turned off by default. Please either specify a ***
    *** fully qualified symbol module!symbolname, or enable resolution ***
    *** of unqualified symbols by typing ".symopt- 100". Note that ***
    *** enabling unqualified symbol resolution with network symbol ***
    *** server shares in the symbol path may cause the debugger to ***
    *** appear to hang for long periods of time when an incorrect ***
    *** symbol name is typed or the network symbol server is down. ***
    *** For some commands to work properly, your symbol path ***
    *** must point to .pdb files that have full type information. ***
    *** Certain .pdb files (such as the public OS symbols) do not ***
    *** contain the required information. Contact the group that ***
    *** provided you with these symbols if you need this command to ***
    *** work. ***
    *** Type referenced: nt!_KPRCB ***
    Probably caused by : mfehidk.sys ( mfehidk+377d7 )
    Followup: MachineOwner
    Darren Rose

    Try it by opening the Cmd prompt as the actual process and passing the Filename and its arguments as the arguments of the Cmd process.  If you notice there is a "-C" before the Filename and Arguments in this example.  The "-C"
    tells the cmd to execute the commands and then close itself.  You can also use a "-K" which tells the cmd to execute the commands and keep itself open.  Being you are not showing the cmd window you don`t want to keep it opened because the
    user can`t close it so, that is why i used "-C".
     I don`t have the program so, you can just experiment to see what it does.  Maybe you should try using "-K" and show the cmd window by commenting out the CreateNoWindow line so you can see what is in the cmd window while testing.
    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
    Dim filepath As String = """C:\Program Files (x86)\Windows Kits\8.1\Debuggers\x86\kd"""
    Dim args As String = " -z C:\windows\minidump\042414-24632-01.dmp -c ""!analyze –v;q"""
    Dim p As New Process
    With p.StartInfo
    .FileName = "cmd.exe"
    .Arguments = "-c " & filepath & args
    .UseShellExecute = False
    .CreateNoWindow = True
    .RedirectStandardOutput = True
    End With
    p.Start()
    TextBox1.Text = p.StandardOutput.ReadToEnd
    End Sub
    If you say it can`t be done then i`ll try it

  • Requirement is to run CMD.EXE under the Local System Account. So that we can map a network drive to be used by a windows service, which will be created by command: - net use z: \\servername\sharedfolder /persistent:yes

    Environment:
    OS:  Windows 7 32/64 bit, Windows 2008 Server 64
    bit/ Windows 2012 Server 64 bit
    Priority:
    - Critical
    Requirement: - Since
    the Windows Service is running under the Local System Account, we would like to emulate this same behaviour.
    Basically, we would like to run CMD.EXE under the Local System Account. So that we can map a network drive to be used by a service using following
    command
    net use z: \\servername\sharedfolder /persistent:yes.
    Already Attempt:
    We tried to launch the CMD.exe using the DOS Task Scheduler AT command.  Here’s a sample command:
    AT 10:36 /interactive cmd.exe
    But I received a warning that “due
    to security enhancements, this task will run at the time excepted but not interactively.”
    It turns out that this approach will work for XP, 2000 and Server 2003 but due to session isolation
    Interactive services no longer work on Windows 7, Windows Server 2008 and above.
      2.  We
    tried to create a secondary Windows Service via the Service Control (sc.exe) which merely launches CMD.exe.
    <Drive>:\sc create RunCMDAsLSA binpath= "cmd" type=own type=interact <Drive>:\sc
    start RunCMDAsLSA
    In this case the service fails to start and results it the following error message:
    FAILED 1053: The service did not respond to the start or control request in a timely fashion.
      3. One
    suggestion, we found to launch CMD.exe via a Scheduled Task, but
    it is not giving any option to launch CMD.exe in interactive mode; so that I can map network drive using net command.
      4. I read an article, which
    demonstrates the use of PSTools from SysInternals. I launched the command line and executed following command
    psexec -i -s cmd.exe
    PSTools worked fine, but It seems that in scope of Sysinternals Software License
    Terms. You may not "use the software for commercial software hosting services."
    Application will deploy on client, which will be like commercial,
    so we are not able to use PSTools.         
    Kindly assist us for achieving the requirement. We have tried all the ways, but nothing is working for us. Kindly suggest.
    I will be really thankful.

    Hi Sir,
    Nothing worked from above for us. You can see our remarks on posted query.
    That’s why, we posted on forum.
    And there will not be any vulnerability, because, if we will use "net
    use ..."
    in network domain; definitely,
    we will provide username and password of mapped drive system.
    And, that system, itself is given by client; so that, there must not be any vulnerability; they are ready to provide user name and password.
    We need a way; by which we can complete the requirement. Kindly assist.
    Regards,
    S. P. Singh

  • Run a cmd command in LabVIEW with parameters

    I have an executable program, for example myprogram.exe, located in "C:\Documents and Settings\myname\myprogram.exe" (I use windows xp 32 bit)
    When I run the program (by running cmd and type "myprogram.exe > to_text.txt" on the command line), the program will print out the result to that text file.
    But when I try to run the whole thing on LabVIEW, I can't manage to do so. LabVIEW only supports using the "Run Command" of Windows, not the cmd. (using the SystemExec vi)
    So how can I run "myprogram.txt > to_text.txt" on LabVIEW as I run it in cmd? Moreover, how can I send the break event (by pressing Ctrl+C in the cmd) by LabVIEW to stop the program?
    With my appreciations!

    I made this a while ago and haven't tested it too much but it should do what you want.  Provide the application path, then the switches in the array.  It does work with built in commands like dir and copy.
    Unofficial Forum Rules and Guidelines - Hooovahh - LabVIEW Overlord
    If 10 out of 10 experts in any field say something is bad, you should probably take their opinion seriously.
    Attachments:
    Execute Command Line With Switches.vi ‏24 KB

  • How to run a CMD command directly from run ?

    How to run a CMD command directly from run ?
    Like "cmd md D:\abcd". I did this before. But now I totally forgot how to do that ?
    Please help..........

    Hi,
    To add, here is the command CMD reference:
    Cmd
    Best regards
    Michael Shao
    TechNet Community Support

  • Urgent!! running system command in java

    i am trying to run system command(windows) in java. I am getting
    exception as java.io.IOException: CreateProcess: c:\dir
    Please Help.
    Here is the code
    import java.io.*;
    public class RunCommand {
    public static void main(String[] args) {
    try
    //run dir command
    Process p = Runtime.getRuntime().exec("c:\\dir");
    BufferedReader stdInput=new BufferedReader(new
    InputStreamReader(p.getInputStream()));
    BufferedReader stdError =new BufferedReader(new
    InputStreamReader(p.getErrorStream()));
    //read the output
    System.out.println("here is the output:\n");
    while((s=stdInput.readLine())!=null){
    System.out.println(s);
    System.out.println("here is the error if any");
    while((s=stdError.readLine())!=null){
    System.out.println(s);
    System.exit(0);
    }//end try
    catch (IOException e)
    System.out.println("exception Happened" );
    e.printStackTrace();
    System.exit(-1);

    It works fine if you replaceProcess p = Runtime.getRuntime().exec("c:\\dir");withProcess p = Runtime.getRuntime().exec("cmd /c dir");And don't forget to define your s variable.

  • Run shell commands using java program

    Hi guys,
    I am trying to run shell commands like cd /something and ./command with arguments as follows, but getting an exception that ./command not found.Instead of changing directory using "cd" command I am passing directory as an argument in rt,exec().
    String []cmd={"./command","arg1", "arg2", "arg3"};
    File file= new File("/path");
    try{
    Runtime rt = Runtime.getRuntime();
    Process proc = rt.exec(cmd,null,file);
    proc.waitFor();
    System.out.println(proc.exitValue())
    BufferedReader buf = new BufferedReader(new InputStreamReader(proc.getInputStream()));
    catch(Exception e)
    {e.printStackTrace();
    So can anyone please tell me what is wrong with this approach? or is there any better way to do this?
    Thanks,
    Hardik

    warnerja wrote:
    What gives you the idea that the process to execute is called "./command"? If this is in Windows, it is "cmd.exe" for example.It does not have to be cmd.exe in Windows. Any executable or .bat file can be executed as long as one either specifies the full path or the executable is in a directory that is in the PATH.
    On *nix the file has to have the executable bit set and one either specifies the full path or the executable must be in a directory that is in the PATH . If the executable is a script then if there is a hash-bang (#!) at the start of the first line then the rest of the line is taken as the interpreter  to use. For example #!/bin/bash or #!/usr/bin/perl .
    One both window and *nix one can exec() an interpreter directly and then pass the commands into the process stdin. The advantage of doing this is that one can change the environment in one line and it  remains in effect for subsequent line. A simple example of this for bash on Linux is
    import java.io.OutputStreamWriter;
    import java.io.Writer;
    public class ExecInputThroughStdin
        public static void main(String args[]) throws Exception
            final Process process = Runtime.getRuntime().exec("bash");
            new Thread(new PipeInputStreamToOutputStreamRunnable(process.getErrorStream(), System.err)).start();
            new Thread(new PipeInputStreamToOutputStreamRunnable(process.getInputStream(), System.out)).start();
            final Writer stdin = new OutputStreamWriter(process.getOutputStream());
            stdin.write("xemacs&\n");
            stdin.write("cd ~/work\n");
            stdin.write("dir\n");
            stdin.write("ls\n");
            stdin.write("gobbldygook\n"); // Forces output to stderr
            stdin.write("echo $PATH\n");
            stdin.write("pwd\n");
            stdin.write("df -k\n");
            stdin.write("ifconfig\n");
            stdin.write("echo $CWD\n");
            stdin.write("dir\n");
            stdin.write("cd ~/work/jlib\n");
            stdin.write("dir\n");
            stdin.write("cat /etc/bash.bashrc\n");
            stdin.close();
            final int exitVal = process.waitFor();
            System.out.println("Exit value: " + exitVal);
    }One can use the same approach with Windows using cmd.exe but then one must be aware of the syntactic differences between commands running in .bat file and command run from the command line. Reading 'help cmd' s essential here.
    The class PipeInputStreamToOutputStreamRunnable in the above example just copies an InputStream to an OutputStream and I use
    import java.io.IOException;
    import java.io.InputStream;
    import java.io.OutputStream;
    public class PipeInputStreamToOutputStreamRunnable implements Runnable
        public PipeInputStreamToOutputStreamRunnable(InputStream is, OutputStream os)
            is_ = is;
            os_ = os;
        public void run()
            try
                final byte[] buffer = new byte[1024];
                for (int count = 0; (count = is_.read(buffer)) >= 0;)
                    os_.write(buffer, 0, count);
            } catch (IOException e)
                e.printStackTrace();
        private final InputStream is_;
        private final OutputStream os_;
    }

  • Please I can not get a .jar file to run on XP SP3 start/run/cmd/

    I can not get a .jar file to run on XP SP3 start/run/cmd/
    Please help if can figure this out. I'm convinced it is a Windows XP SP3 problem from searching on google and seeing other ppl on XP SP3 with same problem (but no working solution for myself). I'll try to be complete-listing all I've done.
    I had installed: Java SE Runtime Environment v6u14 for Windows Multi-language
    I had checked here it was working properly: http://www.java.com/en/download/manual.jsp
    I'm trying to run this jar file (soht-client-0.6.2.jar):
    http://prdownloads.sourceforge.net/telnetoverhttp/soht-java-client-0.6.2.zip?download
    http://www.ericdaugherty.com/dev/soht/javaclient.html < this is the information for the program.
    (yes the file can be executed and should open the program's window
    I wanted to post screenshot of it but friend that it's working for isn't here)
    _(Please find log of all cmds I did in this post here: http://pastebin.com/f792983df )_
    _I have extracted +'all' the files to: C:\062\+_ (I have tried using other directories, same problem)
    ++I then start/open/run/cmd+
    then I: cd C:\062\+
    then I try various commands - all+ of these do absolutely nothing- meaning no errors, no reply, no window opens, nothing except enters that directoy again:
    java -jar soht-client-0.6.2.jar
    java -jar -client soht-client-0.6.2.jar
    java -client -jar soht-client-0.6.2.jar
    java -jar soht-client-0.6.2.jar soht.properties
    soht-client-0.6.2.jar
    So I try this cmd: java soht-client-0.6.2.jar
    Reply:
    C:\062>java soht-client-0.6.2.jar
    Exception in thread "main" java.lang.NoClassDefFoundError: soht-client-0/6/2/jar
    Caused by: java.lang.ClassNotFoundException: soht-client-0.6.2.jar
    at java.net.URLClassLoader$1.run(Unknown Source)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(Unknown Source)
    at java.lang.ClassLoader.loadClass(Unknown Source)
    at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
    at java.lang.ClassLoader.loadClass(Unknown Source)
    at java.lang.ClassLoader.loadClassInternal(Unknown Source)
    Could not find the main class: soht-client-0.6.2.jar. Program will exit.
    I try this cmd:
    java -jar soht-client-0.6.2.jar -client
    Reply:
    C:\062>java -jar soht-client-0.6.2.jar -client
    Unable to load configuration file: -client - java.io.FileNotFoundException: -cli
    ent (The system cannot find the file specified)
    SOHT Java Client
    The SOHT Java Client requires a properties file. Either start
    the application in the same directory as the soht.properties
    file, or specify the file name on the command line:
    java -jar soht-cleint-<version>.jar c:\soht.properties
    So then I do these cmds which produce the exact same error/reply just above; Unable to load..:
    j_ava -jar soht-client-0.6.2.jar -client soht.properties_
    java -jar soht-client-0.6.2.jar -client C:\062\soht.properties
    So then I copy soht.properties to C root and do:
    java -jar soht-client-0.6.2.jar -client C:\soht.properties <same error as above
    Then from other information I have read I right click on the .jar file, select open with Always open with:
    _"C:\Program Files\Java\jre6\bin\javaw.exe"_
    Try again.. same problem.
    Then I do cmd:
    _"C:\Program Files\Java\jre6\bin\javaw.exe" -jar "C:\062\soht-client-0.6.2.jar"_
    does nothing, retry the other commands same thing (either nothing or those same replies)
    Then I read (http://forums.sun.com/thread.jspa?threadID=5384879) someone had the same problem as I and they solved it by uninstalling all Java/reboot/ then install JDK 6 Update 14 with NetBeans 6.5.1 start NetBeans and then it worked for them.
    So I unistalled all Java, rebooted and gave the cmd another try (before re-installing), now a new error, of course:
    C:\062>java -jar soht-client-0.6.2.jar
    'java' is not recognized as an internal or external command, operable program or batch file.
    Then I install  Java SE and NetBeans Cobundle (JDK 6u14 and NB 6.5.1) Final Release/ reboot/ open Netbeans/
    go to test java page; all is good, run cmds again -and still nothing..
    C:\062>java -version
    java version "1.6.0_14"
    Java(TM) SE Runtime Environment (build 1.6.0_14-b08)
    Java HotSpot(TM) Client VM (build 14.0-b16, mixed mode, sharing)
    I reassociate program with: C:\Program Files\Java\jre1.6.007\bin\javaw.exe_
    same thing.. nothing
    Thank you very much for your time :D_
    PS. My computer has been newly reformatted so needing another reformat I'm sure is not the solution.

    Thank you very much for your replies Taggert_77 & swmtgoet_x :D
    Taggert77_: I have never used NetBeans. I only installed it in the bundle as I had read on another post that somehow installing the bundle magically helped another user with the same problem (he didn't know why it worked after that either).
    Before XP SP3 I was able to execute .jar file through cmd prompt. Now I am not.
    This file is executable, grab it and you will see. Here is a screen shot (program in front is FlashFXP, behind is the cmd prompt and what should happen):http://www.freeimagehosting.net/uploads/53273b4ddf.jpg
    swmtgoetx_: I only did the other cmd's to try to make it spit out something, anything lol :D
    The proper cmd is simply: java -jar soht-client-0.6.2.jar
    I did give your cmd a try, and it produced nothing :( (just like the other correct cmds)
    java -client -jar soht-client-0.6.2.jar soht.properties
    Thank you again...the mystery remains
    PS. If you do a search for this you'll find an amazing amount of XP SP3 users with the same problem and no solution posted that I could find except one chap that did the unistall install order that I did above).

  • Running a command in a command line tool in fastest way

    Before anything I want to clarify some terms : 
    apk
    file (android application package file) : equivalent to executable (exe) files on windows
    aapt.exe
    : A command line tool which comes with android sdk in order to fetch information of an apk file (It obviously has other usages)
    note : This question is not about an android feature. It's all about C# and functionality of .Net framework 
    An
    apk file has a name just same as any other file, but it has a internal name (which will be shown when you install apk file on android os as name of application) 
    with
    aapt.exe I can get internal name of an apk using following command :  
    aapt
    d badging "<apk path>"
    I
    have copied aapt.exe where executable file of my c# application is and I want  :
    Enter
    above command for each apk in selected directory (using GetAllFiles method)
    I want to get internal names of apk files and
    I've tried a lot of ways and I've searched a lot. finally this is what I've got : 
    Process proc = new Process();
    proc.StartInfo.FileName = "cmd.exe";
    proc.StartInfo.RedirectStandardInput = true;
    proc.StartInfo.RedirectStandardOutput = true;
    proc.StartInfo.UseShellExecute = false;
    proc.StartInfo.StandardOutputEncoding = System.Text.Encoding.UTF8;
    proc.Start();
    using (StreamWriter sw = proc.StandardInput)
    foreach (string path in Directories.GetAllFiles(@"E:\apk", "apk"))
    sw.WriteLine("aapt d badging " + "\"" + path + "\"");
    //following line doesn't work because sStandardInput is open
    Debug.WriteLine(proc.StandardOutput.ReadToEnd());
    // There will be a really huge amount of text (at least 20 line per sw.Writeline) and
    //it impacts performance so following line is not really what I'm looking for
    Debug.WriteLine(proc.StandardOutput.ReadToEnd());
    GetAllFiles is
    a function that I've created to fetch all apk file full path. It gets two argument. First argument is path and second one is extension of file you want its full path to be fetched.
    This is not final code.
    As I've commented it out first Debug.WriteLine doesn't
    work and second one is not a good idea. how should I get output from proc?
    I have tried running process by argument and its awful :)
    As another approach :
    Because apk files are basically zip files I can extract them get what I want from them.
    There is an xml file named Androidmanifest.xml in every apk file.
    Androidmanifest.xml is like an ID card for an apk file and apk internal name can be found in it but here are some problems with this approach : 
    1. Androidmanifest.xml is not a plain text file. It's coded and it requires a lot of complexity to decode it
    2. application name (or apk internal name) is an attribute in this file and it's value is not a string value. It's a reference to a file where strings are stored and worst thing is it's not an easy to find out reference. It's just a number

    And you don't get any output from it? Maybe you're passing the arguments incorrectly?
    No. I don't get any result and I have checked arguments and it's correct.
    But you are already running a separate process for every apk file. You start a single cmd.exe and then send it commands that will cause aapt to be run for every file. Unless aapt accepts multiple apk filenames on the command line there's no way
    around using separate processes.
    I didn't know that. anyway speed in this way is much more rather than creating a function. creating a Process object in it and calling function for each apk file.
    I read somewhere that it's possible to run multiple commands in cmd by & operator but as you said I think every command runs aapt. I have tested this approach too and it's very very slow
    fastest approach I have found is what I have wrote here and speed is about  0.6 per apk file which is still slow when there is thousands of apk files.
    I tried an application that does same thing (fetching apk information) and in it's installation directory I found aapt.exe which means it uses this tool to get information but speed is significantly faster rather than my application.   
    So what's your suggestion about this? 

  • Running ssh command in a java application

    Hi there!
    I am trying to run a ssh command from a java application cause I need to store the result.
    Actually I can run this command in the cygwin shell so I need to open the shell and run the command, all trough java.
    so, what my process needs to do is:
    1) open the cmd
    2) run C:\cygwin\cygwin.bat
    3) execute the ssh command
    ssh -l fip-user ipdb fip 42704) print the result of the ssh command.
    Note that the cygwin opens in the same command line window and so will print it's result to the same process inputstream
    Message was edited by:
    RBervini

    Use "Runtime.getRuntime().exec()" to execute the SSH program,
    and you can then get the output of the SSH program
    via the getInputStream() method on the returned Process object.
    Note: there are many pitfalls with this. In particular, most people don't know
    they should create separate threads to drain the input/output pipes.
    See this excellent classic article http://www.javaworld.com/javaworld/jw-12-2000/jw-1229-traps.html
    on how to do it right.

  • Running a command line in Java

    Dear all,
    I have a question, I need to run a command line in a Java program. The commands line is the next:
    cas.exe -i file1
    I have been seeing in internet and I have tried:
    Process ls_proc = Runtime.getRuntime().exec("cmd /c start D:\\cas>cas.exe -i file1");
    it start the window where the cas folder is... but it dont run the commands line : cass.exe -i file1 :(
    Somebody can help me, please??
    Andrea

    try running it like this.
    Process ls_proc = Runtime.getRuntime().exec("cmd /c start D:\\cas>cas.exe -i file1" +"\n");
    if that does not work put this underneath the original.
    ls_proc.newLine();
    or look into the ProcessBuilder class in java.lang.

  • Running Unix command through Java

    Hi
    I am trying to run the unix command "rf filename" through Java and it doesnt seem to work.
    Can anyone help in this case please
    String cm = "rm ";
    String delFile =  args[0];        // this path is /data/temp/filename.doc
    Process p = Runtime.getRuntime.exec(cmd +delFile);Also since i dont have access to delete the file through my login i always login as root for a few commands.
    Is there a way i can specify user name & password & then run the command?
    Please let me know
    Thanx

    Please discard the above msg i got a solution by just adding file.delete
    thanx

Maybe you are looking for

  • NWA Template Installer failed

    NWA -->deploy and change, Template Installer scenario: BI-Java 1,create RFC destinations IN ABAP   error msg: Create Destination in ABAP Import not successful Element 'SAPConfigLib.NW2.Unclassified.createRfcDestination':!BrokerImport.import_of_elemen

  • OBIEE Map viewer integration error

    I have problem with obiee and mapviewer integration. i have completed the phase-1 from the following blog (http://oraclebizint.wordpress.com/2007/09/25/oracle-bi-ee-10133-and-mapviewer-step-by-step-integration-phase1/) At the end when i was trying to

  • Why am I getting this error message when I try to open a photo in Preview?

    I am getting the following message when I try to open a photo in Preview. I have searched for possible solutions and nothing works for me. I have always used Preview to edit photos.

  • Web Server 6.1 Service Pack 6 released

    Sun Java System Web Server 6.1 Service Pack 6 is now available for download from: http://www.sun.com/download/products.xml?id=44989742 In this SP are bug fixes, performance improvements, and certification for SUSE Enterprise Linux 9. An International

  • Yahoo mail new emails freeze with v13.0.1

    Since yesterdays (6/20/12) Firefox update to v 13.0.1 I haven't been able to write a new email using Yahoo mail. Symptoms are: -The autocomplete feature for addresses doesn't work -It takes a long time ~ 3 minutes with the message "loading attachment