Run bat file thru appscript

Hi everyone,
I'm trying to run a .bat file from appscript with the following command:
sLog = sLog

Tags:

  • Hello Aviad,

    This answer isn't AppScript specific, but in general an application wanting to execute a batch file needs to do so by calling it through CMD.EXE. Some applications will do that for you, but it's definitely not standard. I don't know if AppScript already does this, but it's probably worth trying to run the following instead:
    sLog = sLog 
  • Richard Gering wrote:

    Hello Aviad,

    This answer isn't AppScript specific, but in general an application wanting to execute a batch file needs to do so by calling it through CMD.EXE. Some applications will do that for you, but it's definitely not standard. I don't know if AppScript already does this, but it's probably worth trying to run the following instead:
    sLog = sLog 
  • Not that I'm aware of. It's been a while, but I've used Ext.CmdLineWait() in the past. Could you try something like this:
    CMD = "cmd /c C:\Scripts\SBMScript.bat " 
  • My guess is that your AppScript is correct, but IIS is running on Windows as a user who does not have execute privileges on that folder path. If your authentication mode is Windows Auth (not SSO with Windows Auth), IIS will run on the Windows server as the user who has logged in, so every user who would run this script would need NTFS privileges on that file location. If you are using any other authentication mode, IIS will run as a specific Windows user, and that user needs NTFS privileges. Tracking down which Windows user IIS is using requires investigation using Internet Information Services (IIS) Manager. If the script is running from the end user interface (not from a SOAP call), find Default Web Site, expand it, and click on "workcenter". Then open Authentication and click Anonymous Authentication and then Edit. If it is set to a Specific User, that is the Windows user you need to grant access to. If it is set to Application pool identity, you need to double check the app pool being used by right-clicking workcenter, choose Manage Application, Advanced Settings. See the Application Pool, then click on Application Pools and select that pool, right click, Advanced Settings. Look for the Identity, if it is set to ApplicationPoolIdentity, then the user to grant NTFS permissions to is: IIS APPPOOL\YourAppPoolName. Otherwise, it is whatever is specified in the Identity.

    If the script is running from a SOAP entrypoint, do the same steps but on the gsoap virtual directory.
  • It was recently pointed out to me that the in NewTask and NewTaskWait (ModScript or AppScript), the call would fail if the path to the executable/batch file included a space. I do not see a space in your example, so it is likely that your problem is resolved by NTFS (see my previous post). However, if you do have spaces in your script (but possibly simplified it for posting here), try changing your path location to not have a space (you could consider using a softlink (see mklink) in a non-spaced-path to the desired spaced-path). This defect will be resolved in the next release of SBM, codenamed Eugene (probably will be 11.4).