Interacting with cmd.exe

Hi all,
i dunno if this has been asked before, but my problem is to let the user interact with an executable ran via "cmd.exe /c executable".
i have an executable program that awaits a response from the user, but when i used the Streams provided by java.lang.Process after many scenarios i noticed that the process inputStream provides me with the output only when the program is finished, while it returns no text while the program is waiting for response
as an example, my problem looks like :
try {
            Process p = Runtime.getRuntime().exec("cmd.exe /c mysql -u toto");
            BufferedReader reader = new BufferedReader(
                    new InputStreamReader(p.getInputStream()));
              String s = null;
            while ((s = reader.readLine()) != null) {
                    System.out.println(s);
} catch (IOException ex) {
            ex.printStackTrace();
}the mysql command would show "enter password : " or something like that, but this program will not show it...unless the mysql is finished
any ideas? thanks :)

that's right, i tried to look for classes that provide "live streams" in java.io ... i thought the PipedReader and PipedWriter could do it, but i need to get the program's reader and writer for this (and i don't know how to do that...) or maybe those classes are unnecessary and there is another way to do it?

Similar Messages

  • Stuck On Runtime.exec() with cmd.exe

    I've done my best to look through the forums and implement what's been said but I'm getting a problem where my whole Java program freezes when the exec() is executed. Can anyone tell me what I'm missing or have misunderstood ?
            try
                Process runSmodels = Runtime.getRuntime().exec("C:\\Windows\\System32\\cmd.exe lparse predict.pl | smodels 0");
                String smodelsOutput = new String();
                BufferedReader smodelsReader = new BufferedReader(new InputStreamReader(runSmodels.getInputStream()));
                String outputLine = smodelsReader.readLine();
                while(outputLine != null)
                    smodelsOutput += outputLine;
                    outputLine = smodelsReader.readLine();
                smodelsReader.close();
                System.out.println(smodelsOutput);
            catch(IOException exc)
                JOptionPane.showMessageDialog(rootPane, "Could not access Smodels.", "System Call Error", JOptionPane.ERROR_MESSAGE);
            }

    DarioAtUOW wrote:
    Pitfall 1 : Calling .exitValue(). My code doesn't do that.
    Pitfall 2 :Not enptying relevant streams. I do empty the input stream.
    Pitfall 3 : Assuming a command is an executable program. I don't do that, cmd.exe is in my command string explicitly.
    Pitfall 4 : As above in Pitfall 3.
    So, why accuse me of not reading the article ? You probably have many years of experience at Java, unlike me, who is just starting out with it at university.Pitfall 2 : Even though you are processing stdout you are not processing stderr! Always always always process both. This may or may not be the cause of your problem but by copying the process stderr to your System.err you may see why your process is stuck.
    Even Clippy, the Microsoft Office Assistant, could answer questions better than you have attempted to do.Ouch, I'm cut to the bone on your razor sharp wit. Phuck you.

  • Issue with cmd.exe.

    Opening cmd.exe and clicking and/or moving the cursor deletes part of the screen. See picture. W10x86

    Mooly01,
    Windows 10 defaults to having QuickEdit mode enabled as a default.  If you want to disable it for all Command Prompts, you will need to de-select it in two places. 
    Right-Mouse click the title bar and choose Defaults.  
    Uncheck QuickEdit Mode.
    Right-Mouse click the title bar and choose Properties.  
    Uncheck QuickEdit Mode.
    Thanks, John Marlin Microsoft Server Beta Team

  • Problem with cmd.exe  /C SET

    Hi:
    I am trying to set environment variables for an exe file in a Java program.
    I am thinking to do:
    Runtime rt = Runtime.getRuntime();
    Process proc = rt.exec(cmd.exe /C set FILEDIR=c:\temp);
    But, I tried cmd.exe /C set FILEDIR=c:\temp on my xp machine dos window and in the java code. The FILEDIR is null.
    Does someone have any idea what went wrong? Anyother better ways to set environment variables in java codes?
    Thanks.

    cmd.exe opens a new command process. The set command will only be effective in this particular process. As soon as the process closes (which will be immediately the set command completes) the value of FILEDIR will be lost.
    You can see this by doing cmd /K set FILEDIR=c:\temp. This will leave the command process open and you see what the value of FILEDIR is.

  • Description: A problem caused this program to stop interacting with Windows. Problem signature: Problem Event Name: AppHangB1 Application Name: firefox.exe Application Version: 1.9.2.3855 Application Timestamp: 4c48d5ce Hang Signature: 9962

    I am having this problem, in the first window when I try to do anything.
    Description:
    A problem caused this program to stop interacting with Windows.
    Problem signature:
    Problem Event Name: AppHangB1
    Application Name: firefox.exe
    Application Version: 1.9.2.3855
    Application Timestamp: 4c48d5ce
    Hang Signature: 9962
    Hang Type: 0
    OS Version: 6.0.6002.2.2.0.768.3
    Locale ID: 1033
    Additional Hang Signature 1: 5df72ce88195c0212c542e9c8c172716
    Additional Hang Signature 2: 2b94
    Additional Hang Signature 3: 9acafbb8ad01bf9d2eb258d8fddad3ca
    Additional Hang Signature 4: 9962
    Additional Hang Signature 5: 5df72ce88195c0212c542e9c8c172716
    Additional Hang Signature 6: 2b94
    Additional Hang Signature 7: 9acafbb8ad01bf9d2eb258d8fddad3ca
    == This happened ==
    Every time Firefox opened
    == User Agent ==
    Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US) AppleWebKit/533.4 (KHTML, like Gecko) Chrome/5.0.375.99 Safari/533.4

    I suspect a RAM or hardware problem.

  • The program shany ip surrvilance Playback.exe version 4.0.7.3 stopped interacting with Windows and was closed

    in windows server 2008 r2 running shany ip surveillance
    when i want to playback from record file windows encounter error:The program shany ip surrvilance Playback.exe version 4.0.7.3 stopped interacting with
    Windows and was closed

    Hi Koosha,
    You should ask this question on
    Windows Forums.
    Thanks!
    If this answers your question please mark as answer. If this post is helpful, please vote as helpful by clicking the upward arrow mark next to my reply.

  • Interact with exe in java

    Hi!
    I got a old exe file, that no more maintain by any team.
    Unfortunately, requirement has it that I need to run this exe, do some interaction, such as "enter" and "wait" and "input value", get "value"
    And it has to be retrive by java,
    can anyone give idea how should this done?
    I know I can excute this program, but I don't know how to fetch the program any more key board input...
    Thanks

    What sort of exe?
    If it is a GUI, then you will need to use JNI to interact with it. You might find a 3rd party tool that already does this for the GUI/OS that you are targetting. If not you have to write it yourself.
    If it is a command line application then you can use Runtime.exec(). That creates a process without output and input streams. The input stream allows you to send text to the process.

  • OUTLOOK.EXE version 12.0.6668.5000 stopped interacting with Windows and was closed.

    I have an end user whose Outlook 2007 is spontaneously closing. It will enter a 'not responding' state and then shut down (and sometimes relaunch). In going through the event log the following information was obtained. O/S is Win-7, 64-Bit. Any input greatly
    appreciated.
    The program OUTLOOK.EXE version 12.0.6668.5000 stopped interacting with Windows and was closed. To see if more information about the problem is available, check the problem history in the Action Center control panel.
    Process ID: 14ac
    Start Time: 01cf6af126c3ad83
    Termination Time: 79
    Application Path: C:\Program Files (x86)\Microsoft Office\Office12\OUTLOOK.EXE
    Report Id: c7d7556f-d9dd-11e3-a17c-2cd05a89d710
    And further into the Event Log (Application)
    - System
    - Provider
    [ Name] Application Hang
    - EventID 1002
    [ Qualifiers] 0
    Level 2
    Task 101
    Keywords 0x80000000000000
    - TimeCreated
    [ SystemTime] 2014-05-12T14:03:22.000000000Z
    EventRecordID 26088
    Channel Application
    Computer uswal-3PLSJX1.amer.thermo.com
    Security
    - EventData
    OUTLOOK.EXE
    12.0.6668.5000
    14ac
    01cf6af126c3ad83
    79
    C:\Program Files (x86)\Microsoft Office\Office12\OUTLOOK.EXE
    c7d7556f-d9dd-11e3-a17c-2cd05a89d710
    55006E006B006E006F0077006E0000000000
    Binary data:
    In Words
    0000: 006E0055 006E006B 0077006F 0000006E
    0008: 0000
    In Bytes
    0000: 55 00 6E 00 6B 00 6E 00 U.n.k.n.
    0008: 6F 00 77 00 6E 00 00 00 o.w.n...
    0010: 00 00 ..

    Hi,
    The event log in your posting is a general error event which occurs when application stops responding. Please make sure the latest patches and service packs are installed for your Outlook 2007.
    Please also restart Outlook in safe mode(Start > Run, type Outlook /safe and Enter) to check whether Outlook 2007 is still not responding or not.
    Thanks,
    Winnie Liang
    TechNet Community Support

  • Allow a windows non-administrator user to run cmd.exe as administrator without sharing administrator password with the user

    I have standalone Windows 2003 and 2008 Oracle database servers (they are not in a Windows domain environment ). The Oracle DBAs can perform all their routine activities from command line with administrator privileges. For this i've to either share administrator
    user password with the Oracle DBAs or add their windows login user to Administrators group. If i can give the DBA user permission to run windows command prompt without sharing administrator password, i can give them non-administrator login access to Windows
    2003/2008 server. Normally when a non administrator user would try to run a program as administrator on Windows 2008, the user is prompted to input administrator username/password. Is it possible to give non-admin user access to run a program/application (cmd.exe
    in this case) on Windows 2003/2008 without sharing administrator credentials with them?

    With the OTORISER application I developed, normal users can run applications with admin privilege …  
    Otoriser is totally free ! Applications, mmc consoles, control panel cpl files can be run under admin and system context with Otoriser. Let’s say you donot want your users to be admin in their machines, but want them to run some applications with admin rights.
    If this is the case then you are on the right blog.
    There are two components for Otoriser. Management and client components. There are no complex implementation and no frustrating steps to be performed. Within 10 minutes you can start testing the results
    After you download the setup files, install client components in the client by running it directly (or any deployment method you have), it will take about 5 seconds to install it. Then, let’s say you want your user to change system properties of the machine.
    With the tool provided in Admin package produce the hash of system.cpl file and enter that hash into the group policy (details are provided in documentation). When policies are applied for that user then he or she can run that control panel applet under admin
    context but donot forget that the user is still an ordinary user.
    download link :
    http://burakuysaler.wordpress.com/2013/02/21/with-the-otoriser-application-that-i-developed-normal-users-can-run-applications-with-admin-priviledges

  • Running a CMD.exe from PowerShell with arguments

    Hello guys, I am working with a driver backup program that I need to automate. I am using Power shell to run a few other tasks, like check the OS version and create a folder based on the system type for drivers. We deploy many different devices and needed
    a way to automate. That is neither here nor there. Here is what I am trying to run, but the CMD, will not seem to pick up the arguments. If I run from the CMD prompt, it will run as expected, but when I lick it off with Power shell, I get a few errors. 
    Here is what I have:
    $command = @'
    cmd.exe /C C:\DriverBU\DrvBK.exe MODE="BACKUP" BKPATH="C:\TempDrivers" BKDESC="Drivers" BKFILE="Backup %NOW%  %COMPUTERNAME%.bki" BKPATHFTM="%COMPUTERNAME%" BKDEVFMT="%DEVNAME%" BKDATEFMT=""
    OPT="HW"
    Invoke-Expression -Command:$command
    This will open the program, however, will not run the arguments.
    Thoughts?
    Thank you!
    Paul
    Duramaxster

    Hello guys, I am working with a driver backup program that I need to automate. I am using Power shell to run a few other tasks, like check the OS version and create a folder based on the system type for drivers. We deploy many different devices and needed
    a way to automate. That is neither here nor there. Here is what I am trying to run, but the CMD, will not seem to pick up the arguments. If I run from the CMD prompt, it will run as expected, but when I lick it off with Power shell, I get a few errors. 
    Here is what I have:
    $command = @'
    cmd.exe /C C:\DriverBU\DrvBK.exe MODE="BACKUP" BKPATH="C:\TempDrivers" BKDESC="Drivers" BKFILE="Backup %NOW%  %COMPUTERNAME%.bki" BKPATHFTM="%COMPUTERNAME%" BKDEVFMT="%DEVNAME%" BKDATEFMT="" OPT="HW"
    Invoke-Expression -Command:$command
    This will open the program, however, will not run the arguments.
    Thoughts?
    Thank you!
    Paul
    Duramaxster
    Part of your problem is that you cannot use @''@  (a here string) to specify a command because it retains the line breaks.
    ¯\_(ツ)_/¯

  • How to create a activex control to execute cmd.exe with parameters?

    Hi,
    Is there any way to execute a cmd.exe on client side using activex.
    currently i am using vs-2013
    Please help i have no idea about activex control.
    Pawan

    No, there is certainly no server side setting that will allow you to do this. Please refer to the following links for more information:
    http://stackoverflow.com/questions/1791511/run-exe-from-client-side
    http://stackoverflow.com/questions/5787200/how-to-open-command-prompt-from-my-application-client-side
    http://p2p.wrox.com/javascript-how/24362-how-call-shell-cmd-open-exe-clientside.html
    Please remember to mark helpful posts as answer and/or helpful.

  • Interacting with Powershell from Java

    Hi,
    I'm trying to run a Java application which creates a new powershell process on startup and then later on interacts with it multiple times. Calling powershell.exe and have it execute a single command and return the output works fine for me. The problem arises if I don't want the powershell process to immediately finish/exit but to stay open so I can write to its outputStream and receive results back from the inputStream.
    String input = "dir";
    String[] commandList = {"powershell.exe", "-Command", "dir"};
    ProcessBuilder pb = new ProcessBuilder(commandList);
    Process p = pb.start();
    if(input != null) { 
    PrintWriter writer = new PrintWriter(new OutputStreamWriter(new BufferedOutputStream(p.getOutputStream())), true);
    writer.println(input);
    writer.flush();
    writer.close();
    //p.getOutputStream().close();
    Gobbler outGobbler = new Gobbler(p.getInputStream());
    Gobbler errGobbler = new Gobbler(p.getErrorStream());
    Thread outThread = new Thread(outGobbler);
    Thread errThread = new Thread(errGobbler);
    outThread.start();
    errThread.start();
    System.out.println("Waiting for the Gobbler threads to join...");
    outThread.join();
    errThread.join();
    System.out.println("Waiting for the process to exit...");
    int exitVal = p.waitFor();
    System.out.println("\n****************************");
    System.out.println("Command: " + "cmd.exe /c dir");
    System.out.println("Exit Value = " + exitVal);
    List<String> output = outGobbler.getOuput();
    input = "";
    for(String o: output) { 
    input += o;
    System.out.println("Final Output:");
    System.out.println(input);
    This code returns the result of the "dir" command from a powershell - fine. But as you can see, I'm trying to run a second "dir" command using
    PrintWriter writer = new PrintWriter(new OutputStreamWriter(new BufferedOutputStream(p.getOutputStream())), true);
    writer.println(input);
    writer.flush();
    This has no effect whatsoever - no second dir output is shown when I run my code. I've also experimented with a powershell.exe option to open the powershell but not close it immediately:
    String[] commandList = {"powershell.exe", "-NoExit", "-Command", "dir"};
    But then my code hangs, meaning the Gobbler's who consume the process's inputStream don't read anything - strangely enough: they don't even read the first line - there must be at least some output....
    I've also tried to close the process's outputStream after writing the second "dir" command to it - didn't change anything.
    But when I initially call the cmd.exe using the /k (keep open) switch:
    String[] commandList = {"cmd.exe", "/k", "dir"};
    I can then still write to that outputstream and invoke the second "dir" command and get the output of both "dir" commands from the inputstream fo that process.
    Any help is highly appreciated.
    Thanks
    Kurt

    user4491593 wrote:
    BUT: my Gobblers only read the output of all my commands Then why don't change your Gobbler code ? ;)
    Test this, it's ugly and needs improvemens, but by now works fine on linux and windows:
    public class Gobbler implements Runnable {
        private PrintStream out;
        private String message;
        private BufferedReader reader;
        public Gobbler(InputStream inputStream, PrintStream out) {
            this.reader = new BufferedReader(new InputStreamReader(inputStream));
                   this.out = out;
            this.message = ( null != message ) ? message : "";
        public void run() {
            String line;
            try {
                while (null != (line = this.reader.readLine())) {
                    out.println(message + line);
                this.reader.close();
            } catch (IOException e) {
                System.err.println("ERROR: " + e.getMessage());
    public class PowerConsole {
        private ProcessBuilder pb;
        Process p;
        boolean closed = false;
        PrintWriter writer;
        PowerConsole(String[] commandList) {
            pb = new ProcessBuilder(commandList);
            try {
                p = pb.start();
            } catch (IOException ex) {
                throw new RuntimeException("Cannot execute PowerShell.exe", ex);
            writer = new PrintWriter(new OutputStreamWriter(new BufferedOutputStream(p.getOutputStream())), true);
            Gobbler outGobbler = new Gobbler(p.getInputStream(), System.out);
            Gobbler errGobbler = new Gobbler(p.getErrorStream(), System.out);
            Thread outThread = new Thread(outGobbler);
            Thread errThread = new Thread(errGobbler);
            outThread.start();
            errThread.start();
        public void execute(String command) {
            if (!closed) {
                writer.println(command);
                writer.flush();
            } else {
                throw new IllegalStateException("Power console has ben closed.");
        public void close() {
            try {
                execute("exit");
                p.waitFor();
            } catch (InterruptedException ex) {
        public static void main(String[] args) throws IOException, InterruptedException {
            /*   PowerConsole pc = new PowerConsole(new String[]{"/bin/bash"});
            PowerConsole pc = new PowerConsole(new String[]{"/bin/bash"});
            pc.execute("pwd");
            pc.execute("ls");
            pc.execute("cd /");
            pc.execute("ls -l");
            pc.execute("cd ~");
            pc.execute("find . -name 'test.*' -print");
            pc.close();
            //      PowerConsole pc = new PowerConsole(new String[]{"cmd.exe"});
            PowerConsole pc = new PowerConsole(new String[]{"powershell.exe", "-NoExit", "-Command", "-"});
            System.out.println("========== Executing dir");
            pc.execute("dir");
            System.out.println("========== Executing cd\\");
            pc.execute("cd \\"); Thread.sleep(2000);
            System.out.println("========== Executing dir");
            pc.execute("dir"); Thread.sleep(2000);
            System.out.println("========== Executing cd \\temp");
            pc.execute("cd \\temp"); Thread.sleep(2000);
            System.out.println("========== Executing dir");
            pc.execute("dir"); Thread.sleep(2000);
            System.out.println("========== Executing cd \\bubba");
            pc.execute("cd \\bubba"); Thread.sleep(2000);
            System.out.println("========== Exiting .... bye.");
            pc.close();
    }I tested this and there is still a little problem -look at the test below.
    It seems that when thecommand
    executed in the powershell prints only a one ot two lines,
    powershell doesn't flush the output stream
    .... but this rather problem of powershell, not the java code
    I have not a clue how to force powershell to flush
    it's output stream after each command.
    C:\temp>java -jar PowerShell.jar
    ========== Executing dir
        Directory: Microsoft.PowerShell.Core\FileSystem::C:\temp
    Mode                LastWriteTime     Length Name
    -a---        2012-01-09     01:16       5290 PowerShell.jar
    ========== Executing cd\
    ========== Executing dir
        Directory: Microsoft.PowerShell.Core\FileSystem::C:\
    Mode                LastWriteTime     Length Name
    d----        2012-01-08     02:56            61587b977687a6e22fbe
    d----        2011-12-14     03:19            Documents and Settings
    d----        2011-12-15     00:05            oraclexe
    d-r--        2012-01-08     03:44            Program Files
    d----        2012-01-05     19:59            sqldeveloper
    d----        2012-01-09     01:15            temp
    d----        2012-01-09     01:13            WINDOWS
    -a---        2011-12-14     03:12          0 AUTOEXEC.BAT
    -a---        2011-12-14     03:12          0 CONFIG.SYS
    ========== Executing cd \temp
    ========== Executing dir
        Directory: Microsoft.PowerShell.Core\FileSystem::C:\temp
    Mode                LastWriteTime     Length Name
    -a---        2012-01-09     01:16       5290 PowerShell.jar
    ========== Executing cd \bubba
    Set-Location : Cannot find path 'C:\bubba' because it does not exist.
    At line:1 char:3
    + cd  <<<< \bubba
    ========== Exiting .... bye.
    C:\temp>

  • Interacting with VBscript - Shell/GuiTree

    Hi all,
    I am experiencing problems to interact with a GuiTree. The Script Devolopment Tool i SAPGUI tells me:
    Type: GuiShell
    Name: shell
    SubType: Tree
    "/app/con[0]/ses[0]/wnd[0]/usr/ssubAREA05:SAPLCRM_CIC_NAV_AREA:0101/tabsTABSTRIP/tabpNA_TAB1/ssubSUB_TAB:SAPLCRM_CIC_NAV_AREA:0102/cntlNAV_CUST_CONT/shellcont/shell"
    I know there is alot of commands to interact with these GUITrees like:
    CollapseNode
    DoubleClickNode
    etc.
    But I havent figured it out how to use em on the info above that the script dev. tool gives me. Can anyone give me an example how to use it or a just a short explaination?
    I am very greatful for any help.
    Best Regards,
    Daniel Lindé

    I don't know exactly how to solve your problem, but here's a few things you can look at.
    1. You didn't say which computer you are on. At any rate, on Windows, you have to be careful and call the cmd.exe when you are trying to execute batch files (vs executing some other .exe).
    2. You MAY be in trouble from latex. This is an argument from analogy - a specific problem I ran into.
    I had a program written in C, which used lex/yacc. The input was read by lex. It turns out that the (Windows) implementation of lex - actually flex - used a function "isatty" to figure out whether to get input character-by-character or doing block reads. Well, when I used Runtime.exec, - for whatever reason - the C program got back a bad value, and bombed trying to read blocks of input.

  • To Interact With Printer

    hi people
    i want to interact with printer . My Problem is i have given the .exe file tht does the job of prining the .pdf files.. i neeed to check weather the printer is working properly and i have to handle the excpetion tht comes from the printer.. can we implement this...
    this is urgent ....

    Let me see if I have the correct spin on what you want to do...
    You have an exe that you have to hand a PDF off to from your Java applicatons.
    You need to check if the printer is working.
    If the printer is not working you need to handle the exception that it will return.
    Since you have an EXE i will assume you are in windows....
    You'll need to check the printer first to see if it works and handle the appropriate exceptions, then I will assume also (my crystal ball is vague this morning) that you will be calling the exe with a cmd and using a command line argument for the PDF and once the print is done, the exe will terminate.
    If not then you will have to build an OLE/DDE interface in JNI depending on what your EXE will support.
    Can you implement this? I don't know, post some of your code and let's see where you have problems and be specific with questions... other wise if you are looking for someone to code it for you... then contact one of your local consulting firms, I'm sure they can get if for you.

  • 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

Maybe you are looking for