18 January 2026:


This forum is now archived and is in read-only mode. Please continue discussions on our improved new Sahi Pro Community forum.



Sahi Pro is an enterprise grade test automation platform which can automate web, mobile, API, windows and java based applications and SAP.

Calling Batch file from sahi

aakash_1983aakash_1983 Members
edited November -1 in Sahi - Open Source
Hi All,

Iam trying to call a batch file by the below given syntex in sahi :

_execute("C:/Documents and Settings/Anjani/sahi_New/userdata/scripts/a.bat");

i have tried :
_execute("C:\\Documents and Settings\\Anjani\\sahi_New\\userdata\\scripts\\a.bat");

in both of the cases iam getting message in sahi as :

--Stopped Playback: SUCCESS--

But nothing happenes and the batch file does not gets executed.



Please help.

Thanks and Regards,
Aakash

Comments

  • any updates on this??
  • the syntax is correct. Validates path. Bat and if the job is running.
    I am running a batch correctly so:

    _execute("C:\\sahi\\userdata\\bin\\start_app.bat");

    good luck
  • Hi Facilos,

    Thanks for your reply.I have checked the path but still i am facing the same issue.
  • Hi All,

    I am still not able to run the bat file with the above command in the posted query.
    The path of bat file is correct and the syntax too but the bat file does not run as iam calling ax exe from the batch file and noting happenes.

    While running the batch file manually it is getting executed perfectelly.

    Iam using sahi 3.5 OS on windows xp.



    Please Help.

    Thanks and Regards,
    Aakash
  • I am also getting same problem as Aakash

    Kindly help.
  • facilosfacilos Members
    edited October 2012
    Hello Friends, not to say I'm running the code I sent them and it works.

    my system is:

    Win 7 (x64)
    Sahi OS 3.5
    Chrome

    Enclosed is my full function where the _Execute use twice. One to call AutoIt and another to call a. Bat.

    good Luck


    function start(){
    try{
    _execute("C:\\Program Files (x86)\\AutoIt3\\AutoIt3.exe C:\\1.au3");
    var $contents = _readFile("C:\\sahi\\userdata\\config\\database.txt");
    _setGlobal("RutaDB", $contents);
    var $rs=ConectarMysql("1","");
    VarGlobal();//carga variables globales de BD
    for (var $i=0; $i < $rs.length; $i++){
    if($rs[$i]["Ctr_Estado"] == "1"){
    FileObjects();//OAC
    Keyword_Driver($rs[$i]);
    }
    }
    _execute("C:\\sahi\\userdata\\bin\\start_app.bat");
    }catch(e){
    _logExceptionAsFailure(e);
    }
    }

    show-image.php?id=3cd8e8bfa24af9188e1918dee0fcf3bd
  • For those who still cant get the _execute command working, I got it working by adding _log.

    Example :
    _log(_execute("C:\\file\\path\\runthis.bat ", true));

    OR for bat file with parameter:

    _log(_execute("C:\\file\\path\\runthis.bat " + $parameter1 + " "+ $parameter2, true));
Sign In or Register to comment.