I am working with an API within my own C++ program that communicates with a 3rd party application of the API through a server -client relationship of a TCP connection. At this time, I have to manually open the server console application (.exe) first, followed by the client console application (also .exe). Both these windows must remain open in the background throughout my application in order to perform the necessary tasks.
I would like to automate the execution of these two .exe's in the order that I have presented above. I have tried two consecutive ShellExecute() Windows API function calls, I have tried the old system() function and I have tried opening a batch file like this:
ShellExecute(NULL,"open","ocrtext.bat",NULL,NULL,SW_SHOW);
Where the batch file goes something like this:
START c:\videoocr\server\ocrD.exe
START /w c:\videoocr\server\ocrGW.exe
The same problem exists with all these options: The server console window opens fine, but the client window fails to open. I suspect that the problem has to do with an inability to call multiple console applications that each stay open with these methods.
What can I do? Thank you in advance.
call the application in your batch file with this command:
start "App1" /min cmd.exe /c startApp1.exe
start "App2" /min cmd.exe /c startApp2.exe
...
With this a batch file can open different consoles.
Related
I'm creating a launcher using electron. It launches applications and files in my Windows system using the shell.openExternal command.
It works well when I call shell.openExternal passing .lnk shortcuts as parameters, but when I call some apparently equal shortcuts created by, for example, GoG installers, the game is not launched and I can't debug what happens. I know that the shortcut is called but the target application crashes. I got this message from Lichdom: Battlemage launcher:
Witcher 3 also fails, nos message is displayed. When I call these shortcuts directly from the system, they work fine. If I manually create an apparently exact same shortcut to the same file, it launches normally in both electron and the explorer.
Any ideas what could be happening or how to debug?
I am running node on windows server with iisnode.
In my code I upload file and then start some external application to do conversion of this uploaded file. To do this I am using child_process.fork().
It works fine with one file. If I run two requests, so two instances of external application should be started, it doesn't work as intended. First request is fine, but second one fails, when trying to start second instance of external application.
I get message: "Error: Command failed: ..."
In Task Manager I can see that second instance of cmd and external application is started, but just for a second and then it terminates.
When I try to do this process manually, it works. I open two cmd windows and start two instances of this external application and they do file conversion without any problems.
What could be causing problems when trying to do this from node?
I'm trying to run a task on the Worker Role. I added a file named Startup.cmd with the following content:
icacls "PDFs" /grant Users:(OI)(CI)F
EXIT /B 0
All this does is give the Users group full control to the PDFs folder. The task does run because the Microsoft Azure Activity Log window shows the message Details: Starting role... Application startup tasks are running. [2015-02-04T23:39:28Z] when the Worker Role is deployed. I then log into the machine using Remote Desktop and the security on the folder is not as expected. I then try to run the command manually and I see this:
The file has some weird characters which is making the command fail: icacls.
Can Azure Publishing be causing this?
It looks like your script is being saved with a byte order marker. Try saving the script as ascii or as UTF-8 without a BOM. That might work out better for you.
I'am currently writing an application that has to search on a web site if an update exists for this application. If it is the case the application download a setup file (created with inosetup) and then execute it.
My application is written in C++. And I do not arrive to do this process. I'am trying to call the setup using system(). If the command is system("mysetup") I cannot obtain what I want because the setup cannot replace the exe (currently running). So, I have tried to use system("cmd /C mysetup"), system("cmd/C start /min mysetup"), system ("cmd /C start /min /separate mysetup") without success. In these cases, the fact to stop the application also stop the setup. So I suppose that the setup is considered as a child process.
I have seen in some posts that it might be possible to use execcl(). But this function is in unistd.h. And this library is a little bit to specific for my needs (I need to be able to run on virtualized windows).
So do you have a way to do what I want?
Thanks for your help
OK,
A colleague to me gave me the solution. As we are using QT a QProcess::startDetached does exactly what I want.
I have a windows application with user Interface that do some stuff...
Now my client wants that, when he pushes the power button MyApplication run before he forced to input the username and password!
comment: the system is multi user on windows XP or Seven.
Is it possible anyway?
I found the way to do this was to create a scheduled task with a trigger for "on startup". This starts the application before windows logon. This is particularly useful in a server type environment if you need to have something run that is not a service.
It is simple. The process is.
Run gpedit.msc
Go to computer Configuration -> Windows Setting -> Scripts(Startup/shutdown)
Go to Startup properties then you will get the new windows.
Now add the program that you want to run before login.
The right way to do this is to implement a Windows service.
I've used this article here as I run a Minecraft server which I need to have the console interactive so I can manage the server and running it as a service is not a good solution in such a case: https://www.tenforums.com/tutorials/138685-turn-off-automatically-restart-apps-after-sign-windows-10-a.html
What I did was edit the registry:
Go to HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon
Create a new DWORD value (if this DWORD doesn't exist already) and
call it RestartApps with the value of 1
This now starts apps that usually startup before you log in and starts the programs in shell:startup
You can not run an exe without first loading the operating system. You can, however, run the exe without logging in first. Just add copy and paste the shortcut for the exe into C:\Documents and Settings\Administrator[or other user name]\Start Menu\Programs\Startup. Then check msconfig to make sure your exe is checked to run on startup.