Forum Stats

  • 3,839,777 Users
  • 2,262,536 Discussions
  • 7,901,054 Comments

Discussions

Host Command in 12C?

RajeshAlex
RajeshAlex Member Posts: 110 Red Ribbon

Does Host command works fine in Forms 12C?

I try to invoke a batch file (our application server is in windows) . However it does not work.

Batch file is a simple file with log just to make sure the script gets executed. I am able to run the batch file when I login to the application user and with the user which oracle has been installed.


However when I try to call this from forms it does not work.


I tried to run host('notepad.exe') from a client form hoping that this would invoke the notepad in the application server. However it did not work. The form was just hanging.

Its a while I used this feature. I used this in 6i,9i and 10g


Thanks

Rajesh Alex

Tagged:

Answers

  • Michael Ferrante-Oracle
    Michael Ferrante-Oracle Senior Principal Product Manager USMember Posts: 7,330 Employee

    If you start the servers (e.g. WLS_FORMS) using a Windows service then HOST calls you make will not have access to the desktop therefor the process cannot display the GUI (e.g. Notepad). The result is that although Notepad may be running, you will not see it.

    In short, it is not recommended that you make any HOST call that will require a UI. Regarding your call to a script, assuming it doesn’t try to launch a proc with a UI it should work. However, keep in mind that the environment that will be used is defined in default.env. So if PATH, as an example does not have the correct value(s) to find your script or exe that may be called in then it won’t run successfully.


    Michael Ferrante

    Senior Principal Product Manager

    Oracle

    Twitter: @OracleFormsPM

  • RajeshAlex
    RajeshAlex Member Posts: 110 Red Ribbon

    Mike,

    Thanks for your response.

    I didnt get below

    However, keep in mind that the environment that will be used is defined in default.env. So if PATH, as an example does not have the correct value(s) to find your script or exe that may be called in then it won’t run successfully.

    My application server is in windows. I think WLS is installed as a Service.

    In the default.env I see the PATH as below

    PATH=C:\Oracle\Middleware\Oracle_Home\bin;C:\App\Oracle\jdk\jre\bin\client;C:\App\Oracle\jdk\bin

    I am able to retrieve this PATH using TOOL_ENV.GETVAR('PATH', v_path ); from the forms.


    My batch file is simple. It copies one file to another file

    copy /y c:\temp\pp\abc.txt     c:\temp\pp\abc123.txt


    And my batch file name is host_batch_file.bat

    From the forms I call using the hard coded path.

    C:\temp\host_batch_file.bat

    I put it in multiple folders and it does not work.

    When I run the batch file from the command prompt/dos it works fine.

    Not sure whats happening here/how to trouble shoot further


    Best Regards

    Rajesh Alex

  • RajeshAlex
    RajeshAlex Member Posts: 110 Red Ribbon

    I think what you are referring is the PATH needs to have C:\Windows\System32 where the cmd.exe resides or

    instead of calling HOST ('cmd.exe /C C:\TEMP\copym.bat', NO_SCREEN);

    use below


    HOST ('C:\Windows\System32\cmd.exe /C C:\TEMP\copym.bat', NO_SCREEN);


    Rajesh ALex