Unable execute external process from CGI C++ - c++

I have a problem about call external process from CGI C++.
I want to run a macro (*.xls file) from CGI code directly but it's not working. I just see the EXCEL.exe process existing in the task manager (CGI run on APACHE). When I have run it on the command line then it worked.
system("start excel \"C:\Temp\91a3e34f-e2e4-442f-af32-4a38bef95a8e\FrfmMod91a3e34f-e2e4-442f-af32-4a38bef95a8e.xls\"");
Does anybody help me?

Related

Cannot require luacom library in lua script

I am new to Lua programming language. I installed Lua for Windows v5.1.5-52. I want to use luacom library to run shell script. Here is my code,
local luacom = require('luacom');
local shell = luacom.CreateObject("WScript.Shell")
shell:Run ('echo 123', 0)
which throws the following error:
lua: COM exception:(.\src\library\tLuaCOM.cpp,398):The system cannot
find the file specified.
I looked for tLuaCOM.cpp file, but could not find it, not even folder src. Though I found luacom.dll in clibs folder.
Is there any workaround with this problem?
tLuaCOM.cpp is a luacom source file, so it's probably not on your PC, except you've build it yourself.
The error comes from one of the calls - either CreateObject() or Run.
The Run Method (Windows Script Host) helps says that it starts processes:
The Run method starts a program running in a new Windows process.
but echo is a shell command, not an executable, so you have to start an instance of the Windows command interpreter and pass your command like:
shell:Run('cmd /c "echo 123"')

How to enable System Error message when running executable from command line

According to Microsoft, "If [the system] cannot locate the DLL, the system terminates the process and displays a dialog box that reports the error. " This is the result I get when I run my application outside of the command line, but I do not get the same system error when I run the application from a shell environment such as command prompt or powershell.
Is there a way to show the same error message when the application is run from a command line interface?
https://msdn.microsoft.com/en-us/library/aa271571(v=vs.60).aspx
SetErrorMode(GetErrorMode() & ~SEM_FAILCRITICALERRORS);
but I don't think you want to do this, as you do not know in which environment the user will run your application.
It is usually now a good idea to popup a dialogbox in e.g. a service environment.
What is the problem with examining the error code of whatever is failing e.g. LoadLibrary() and reacting to this error?

Windows Qt Invoke batch file and exit the App

I am developing an application in Windows8 using Qt, where I need to create an updater for it. I have Already wrote the update downloader part, and an update script to replace all the previous content with newly downloaded data.
Now I need to execute the bat file from the application itself, and exit the app before the script get executed, because the script going to remove all the dlls and application binary currently I am running.
How can I resolve this issue?
Thanks
Haris
You can use QProcess::startDetached to run an instance of command prompt with the batch file as the argument in a new process and detach from it. After that you should exit the application :
QProcess::startDetached("cmd.exe", QStringList() << "/c" << "path\\to\\mybat.bat");
qApp->quit();

how to execute the 'net use' command from the c++ code by system() method in visula studio 2012?

i use the following way to execute it
system("net use * /del /yes");
but it gives the following
`'net' is not recognized as an internal or external command, operable program or batch file.`
but when i run the same command on the CMD it is executed successfully. as
You have these remote connections:
Z: \\x.x.x.x\x
Continuing will cancel the connections.
The command completed successfully.
The issue was of Environment Path add the Path "C:\Windows\System32" then it will execute properly and give the output correctly.

coburtura link with marathon

I am newbie in coburtura and marathon. I have few doubts regarding integration of coburtura with marathon. Using ant I tried to run the coburtura using the jar file which is used in marathon. cobutura.ser file is not updated when marathon automation testing completed. Kindly let me know how to connect .ser file into marathon?
Marathon aborts the AUT, rather than exiting it. I suspect that is the issue with the 'ser' file not being written. One option is to include the exit actions in the script.