Forum Discussion

TCBeginner's avatar
TCBeginner
New Contributor
9 years ago

Need help in below scenario

Hi All, Please help in below scenario:

 

1. I have started cmd using testedApp.cmd.Run

2. Want to set another path as C:\A\B

 

and then type <anycommand> and Enter

 

I am not able to do it , Please provide mw quick help.

 

Many thanks in advance.

2 Replies

  • TCBeginner's avatar
    TCBeginner
    New Contributor

    Below code also is not working:

     

    Set objShell = CreateObject("WScript.Shell") ' Create object of Shell
    objShell.Run "CMD /K" ' Open Command mode

     

    objShell.SendKeys("CD C:\applications\deal-o-matic")' To type a command

     

    Please help...

    • AlexKaras's avatar
      AlexKaras
      Champion Level 3

      Hi,

       

      1) Changing Path for some given cmd session changes environment for the given session only (and its spawned processes). So in order to have an effect from changed Path value you must execute all subsequent commands from the same cmd session;

       

      2) I am doubting that you are testing how cmd handles its environment... What is the actual task that you need to do?

       

      3) > Below code also is not working:

      It would help if you let us know what exactly does not work, what error do you have and all other details that might help any other person to understand the problem and try to help with the solution.