There is 2 ways that I can run exe file: with double click or via command line.
I want to do different function from each way..
Is it possible?
Thanks!
You could also start via a Process, Schedule, register an extension, Autostart any many more. You need to tell us what you want to achieve for a satisfying answer. Following Answer is for switch a command-line and a gui mode.
If you have the Install of you Program in you hands, you can simply use "Command" to read the commandline arguments and use that for a command line mode and a gui mode.
Make a switch like "-gui" and simply write
If Command = "-gui" Then
frmMain.Show
End If
Related
I know that I can specify program arguments in CLion with Edit configurations, but I find it quite inconvenient when I want to quickly run the program with new arguments and don't want to store it in a separate run configuration. Is there something like a shortcut displaying dialog with arguments input?
I know I can always use terminal, but I'd like to have an access to CLion's GUI debugger.
I am trying to make a simple ruby script. However, when I run it, the command line opens, and closes almost immediately. I had the same problem with a visual basic console application, so I'm not sure if this is a problem with command prompt.
I am running Windows 8 with Ruby 1.9.3. Any help is appreciated.
This is a common symptom when developing command line applications on Windows, especially when using IDEs.
The correct way to solve the problem is to open the command line prompt or PowerShell manually, navigate to the directory where the program is located and execute it manually via the command line:
ruby your_program.rb
This is how command line programs were designed to be executed from the start. When you run your code from an IDE, it opens a terminal and tells it to execute your program. However, once your program has finished executing, the terminal has nothing to do anymore and thus closes.
However, if you open the terminal, then you the one telling it what to do, not the IDE, and thus the terminal expects more input from you even after the program has finished. It doesn't close because you haven't told it to close.
You can also use this workaround at the end of your Ruby script:
gets
This will read a line from standard input and discard it. It prevents your program, and thus the terminal, from finishing until you've pressed return.
Similar workarounds can be used in any language such as C and C++, but I don't think they are solving the actual problem.
However, don't let this discourage you! Feel free to use gets while you are learning. It's a really convenient workaround and you should use it.
Just be aware that these kinds of hacks aren't supposed to show up in production code.
Are you running from the command line or as an executable. Try placing a busy loop at the end to see the output or wait for keyboard input. If you run outside a command line the command line exits upon completion of the script.
I have an application I would like to write in either MATLAB or SciLab. This question is not about the application itself, but about entry points.
I would like a way for users to click on an icon or shortcut or whatever, and execute the following steps:
If MATLAB or SciLab is not running, launch it and wait until the launch is complete. If it is running already, proceed to step 2.
Run my application (MATLAB or SciLab script)
Any suggestions?
If the only way to do this is from within MATLAB/SciLab (vs. at the command-line) then I'll live with that, but I need to know how to do it.
Put yourself in a user's shoes: You know nothing about MATLAB or SciLab, and a coworker has given you this application that runs under MATLAB/SciLab to use.
What is the easiest way to get that user to be able to use the application, without having to teach them MATLAB commands or setting the MATLAB path or anything like that. (Ditto for SciLab.)
You can call Matlab from the command line. So you could wrap the command line call in a shortcut and all the user would have to do is double click it. I would take a look here and see if these use-cases will help, although I suspect they will.
You can do things like:
matlab -nosplash -nodesktop -r 'plot(0:.1:pi,sin(0:.1:pi))'
I have a lot of perl scripts that are on infinite loop running on my windows system. It is terribly inconvenient to have that many command prompts open not to mention the likelihood of closing them by mistake(strangely, they also seem to pause when I click on the prompt)
Is there someway I can handle this? Like maybe minimize this to the tray and maximize whenever necessary?
If it is of any use, I use activeperl
You can use Console2 utility, which is a Windows console window enhancement, it has a multiple tab feature.
Install GNU Screen. You can get it for Windows as part of Cygwin. You can then have multiple command line shells running in a single window, and can detach that window to run in the background.
Have you considered Win32::Daemon?
How can I find out the command line options a program was launched with under windows?
try: http://www.bleepingcomputer.com/tutorials/tutorial132.html
in short:
use the Process Explorer utility created by Sysinternals (now owned by Microsoft; which is probably why vista and windows 7 now have a similar functionality already present in task manager)
On vista... You can
go to the task manager
Click View --> Select Columns
Add the command line column.
To do this programatically, run "tasklist -v" to a file and then split up the file.
If you are trying to get the command line of another process programmatically you should probably read Why is there no supported way to get the command line of another process?:
Commenter Francisco Moraes wonders
whether there is a supported way of
getting the command line of another
process. Although there are
certainly unsupported ways of doing
it or ways that work with the
assistance of a debugger, there's
nothing that is supported for
programmatic access to another
process's command line, at least
nothing provided by the kernel. (The
WMI folks have come up with
Win32_Process.CommandLine. I have
no idea how they get that. You'll have
to ask them yourself.)
If you are trying to retrieve the command line of your own process you can use GetCommandLine.
Try running the .exe but with the /? flag.