shellexecute

Calling command from Perl, need to see output

蓝咒 提交于 2019-12-09 17:39:23
问题 I need to call some shell commands from perl. Those commands take quite some time to finish so I'd like to see their output while waiting for completion. The system function does not give me any output until it is completed. The exec function gives output; however, it exits the perl script from that point, which is not what I wanted. I am on Windows. Is there a way to accomplish this? 回答1: Backticks, or the qx command, run a command in a separate process and returns the output: print `

Wait before ShellExecute is carried out?

混江龙づ霸主 提交于 2019-12-09 16:22:02
问题 I have a hopefully quick question: Is it possible to delay execution of ShellExecute a little bit? I have an application with autoupdater. After it downloads all necessary files etc, it renames current files to *.OLD and the new as the previous. Simple enough. But then I need to delete those .OLD files. This 'cleanup' procedure is executed on MainForm.OnActivate (with a check if it is the first activate proc). But this apparently happens too fast (I get False from DeleteFile). This is the

How to launch the associated application for a file / directory / URL?

时光总嘲笑我的痴心妄想 提交于 2019-12-09 14:53:48
问题 Linux seems to be easy: xdg-open <file/directory/URL> . Apparently, Mac is similar: open should be used instead of xdg-open . I don't have access to a Mac so I couldn't test it. For Windows , I found 4 different suggestions and those that I have tried failed. Is there a non-java, cross platform way to launch the associated application for a certain file type? suggests start How to give focus to default program of shell-opened file, from Java? suggests cmd /c start ... How to open user system

How do I launch a process with low priority? C#

冷暖自知 提交于 2019-12-09 07:33:27
问题 I want to execute a command line tool to process data. It does not need to be blocking. I want it to be low priority. So I wrote the below Process app = new Process(); app.StartInfo.FileName = @"bin\convert.exe"; app.StartInfo.Arguments = TheArgs; app.PriorityClass = ProcessPriorityClass.BelowNormal; app.Start(); However, I get a System.InvalidOperationException with the message "No process is associated with this object." Why? How do I properly launch this app in low priority? Without the

Shell_exec php with nohup

别说谁变了你拦得住时间么 提交于 2019-12-09 02:59:27
问题 I think there are tons of similar posts but I haven't yet found a solution after searching around. Basically, I'm trying to run two scripts in the background. When I run them in the commandline, I see after calling my first script: /usr/bin/nohup php script.php > nohupoutput.log & echo $! I've tried ...script.php > /dev/null & with the same result. I get: /usr/bin/nohup: ignoring input and redirecting stderr to stdout which I ignore and run the second one. I noticed that it seemed to be

detect selected program opened using openas_rundll in c#

牧云@^-^@ 提交于 2019-12-07 13:06:30
问题 I am opening a file using openfile dialog with the help of openas_rundll in c#. Process.Start("rundll32.exe", string.Format("shell32.dll,OpenAs_RunDLL \"{0}\"", tempFilePath)); Now I want to detect which program is used to open the file. I want to trace the process. My goal is to delete the file when user close the program. 回答1: You can try to catch the moment when actual app is closed by finding it py parent process id. If you found it, you can wait it to close as long as it is acceptable.

Good quality code example of how to call an application and wait for it to exit

久未见 提交于 2019-12-07 09:22:42
问题 Using: Delphi XE2; Windows 32-bit VCL application From within my Delphi application, I need to call an application using ShellExecute and wait until it finishes before proceeding. I see many examples here on SO of ShellExecute with MsgWaitForMultipleObjects but can't know which one is the best because they are mostly doing what is not recommended ie. also using Application.ProcessMessages which is not recommended by many. I see an answer by NFX here in this post which does not use Application

ShellExecute fails for local html or file URLs

放肆的年华 提交于 2019-12-07 09:18:43
问题 Our company is migrating our help systems over to HTML5 format under Flare. We've also added Topic based acces to the help systems using Flare CSHID's on the URI command line for accessing the topic directly, such as index.html#CSHID=GettingStarted to launch the GettingStarted.html help page. Our apps are written in C++ and leverage the Win32 ShellExecute() function to spawn the default application associated with HTTP to display the help system. We've noticed that ShellExecute() works fine

How to run ant command through java program?

可紊 提交于 2019-12-06 15:27:32
问题 I want to run a simple ant -v command through a java program. After searching, I came to a point where I know I have to use shell execute instead of process, since ant is not really an exe format. I have a program that works for executing simple JAVAC command, but ant never works. Here is what my code looks like. Runtime runtime = Runtime.getRuntime() ; Process shellProcess = runtime.exec("D:\\installs\\apache-ant-1.9.2\\bin\\ant -v") ; shellProcess.waitFor() ; I get following exception when

Open a URL in a new browser process

爱⌒轻易说出口 提交于 2019-12-06 08:15:50
问题 I need to open a URL in a new browser process. I need to be notified when that browser process quits. The code I'm currently using is the following: Process browser = new Process(); browser.EnableRaisingEvents = true; browser.StartInfo.Arguments = url; browser.StartInfo.FileName = "iexplore"; browser.Exited += new EventHandler(browser_Exited); browser.Start(); Clearly, this won't due because the "FileName" is fixed to iexplore, not the user's default web browser. How do I figure out what the