Forum Discussion

kumar_N's avatar
kumar_N
Occasional Contributor
14 years ago

Reg: Launch the window application

Hi..



How to launch the application available in the path, instead of Call TestedApps.notepad.Run(1, False).



E.g: I need to launch the application available in the path like c:\Allprograms\applicaiton1.



How to write script for that.





Regards

Naresh

5 Replies

  • karkadil's avatar
    karkadil
    Valued Contributor
    Sys.OleObject("WScript.Shell").Run("c:\\Allprograms\\applicaiton1");
  • kumar_N's avatar
    kumar_N
    Occasional Contributor
    Hi Gennadiy Alpaev

    Tx for your reply.



    I was not able to run the application still. i am getting the run time error.



    E.g To Run the calculator applciation.

    Sys.OleObject("WScript.Shell").Run("C:\\Documents and Settings\\All Users\\Start Menu\\Programs\\Accessories\\Calculator")



    Run time error is coming,"The system can't find the specified file path"





    Regards

    Naresh


  • Hi,



    Enclose the path in quotes:



    Sys.OleObject("WshScript.Shell").Run("\"C:\\Documents and Settings\\All Users\\Start Menu\\Programs\\Accessories\\Calculator\"")


  • kumar_N's avatar
    kumar_N
    Occasional Contributor
    Hi..

    if i copy the same script in vb script its giving code compilation error.

    can u please give the snippet in vb script.
  • karkadil's avatar
    karkadil
    Valued Contributor
    Sys.OleObject("WScript.Shell").Run("""C:\Program Files\application.exe""")



    if you need to run your application with parameters, then



    Sys.OleObject("WScript.Shell").Run("""C:\Program Files\application.exe"" param1 param2""")



    And I really recommend you to start learning the language you are using in your scripts, because you need to be able not only recording scripts, but also write them manually...