Install4j : Executable writing to console return back if we press enter a second time - install4j

When Executable writes to console (using the -console option), if I press "enter" a second time, it bring me back to the command prompt even though Executable is still running in the background. How we can force it to output everything to the console and only when done should it return to command prompt?

The installer on windows is a GUI executable, it cannot make the console wait for the process to finish. There are two ways around this:
1) Select the "Windows console executable" property of the installer on the Installer->Screens & Actions step. Drawback: When starting the installer from the explorer, a console will be opened.
2) Start the installer on the command line like this:
cmd /c installer.exe -c

Related

Run a program in debug mode in eclipse in command line

For several reasons I must test my program with multiple computer restart.
So I need at the computer startup, eclipse open and the tested program runs in eclipse (in debug mode if possible).
Can you give me a command line or another way to do that. I just need when I open eclipse or when I use the given command line, the program automatically start
Thank you
For Linux OS (not sure on Win, Mac), Eclipse (or other apps) can be automated with xdotool utility. Assuming your app has run at least once in debug mode within Eclipse so it exists an entry on Debug history, a Bash script could do the following actions
-Edit the script below to set the correct position value for the app.
-Launch Eclipse.
-Wait some time until is fully up.
-Execute the following command sequence:
#!/bin/bash
position=6
#find Eclipse app window IDs, keep the last one
e_wid=$(xdotool search --class Eclipse | gawk 'END{print $0}')
# Create basic command string
cmd="xdotool windowactivate --sync $e_wid"
# Send key strokes with some delay in between
# Open Run menu
$cmd key Alt+r
sleep 1
# select Debug option
$cmd key h
sleep 0.5
# pick the sixth option in that menu
$cmd key $position
It's recommended to mark the app as a favorite so it gets a constant order in the menu.
To see another example, check this mluis7 gist at Github.

Psexec executed cmd to run further programs which require user input

I have a small problem with my Powershell script.
What do i want:
open CMD via PSEXEC on a remote machine, and work in this "remoteshell" as if i am in front of this machine. There is a commandline tool which i'd like to run, which requires user input after its started (it runs a own "shell")
What the problem is:
i utilize PSEXEC 2.11 with the following command
.\PSEXEC \\$Global:Endpoint -s -accepteula cmd
Cmd gets started as expected.
When i enter the name of the tool (lets call it tool.exe) the inital screen is loaded. But when the shell appears, nothing happens. I can enter commands but there will be no feedback...
C:\windows\System32>tool.exe
Testing Tool V1.0
Command? >
Then nothing can be entered anymore...
I even cannot stop it by pressing CTRL+C. I need to close the application window to force it to close. :(
Any ideas? Are there programs which cannot run in "user interaction" mode?
For reasons, it cannot run as a window visible on the remote endpoint. It needs to run silent.

Cmd.exe no popup

I have to run cmd / c from a program, run the start command xx.exe, and I capture the result (there xx.exe?). until everything is right, however, remains open the console with the error popup. how can I close the console with the error?
Usually win32 applications will close the command prompt after execution. If this isn't the case with what you're trying to run, you could:
Run it from Windows "Run" option (Windows button+R) than your program name and path in prompt.
Run it from a batch file, like so:
runMe.bat:
START "" "C:\windows\notepad.exe"
EXIT`
Than just run runMe.bat from wherever. Notice the 'exit' command that closes the command prompt after execution.
Read more about batch files, the start command, and this issue here, and there.
Good luck!

From command line on win7, how do I launch a process as administrator with elevated UAC

I have a program which requires Administrative privileges that I want to run from a batch file. What command can I run from command line will run my program with administrative privileges? I'm okay with the pop-up window asking for permission. Additionally, the file needs to be able to run from anywhere on a computer so additional files are run from ./src. The problem is that if I right-click and choose "run as administrator" it changes my current directory so ./src no longer works. If I disable UAC on my machine then everything runs fine. Thank you!
Look here: https://superuser.com/a/269750/139371
elevate seems to be working, calling
C:\Utils\bin.x86-64\elevate.exe -k dir
executes dir in the "current directory" where elevate was called.
This is tough, Microsoft provides no utility to do this (mostly because giving a batch file that ability breaks security), except for RunAs, and that requires that the Administrator account be activated.
There IS a JScript program that can do something similar, by using SendKeys to open the Start menu and type cmd[CTL]+[SHIFT]+[ENTER] which will launch a Command-Line shell.
Save the following as as .js file, like StartAdmin.js:
var WshShell = WScript.CreateObject("WScript.Shell");
WshShell.SendKeys("^{esc}cmd^+{ENTER}"); The equivilent of [CTRL]+[ESC] cmd [CTRL]+[SHIFT]+[ENTER]
To run StartAdmin.js from a batch file, you will need the following line:
wscript StartAdmin.js
To launch from a particular directory and launch a batch file, change line 2 in StartAdmin.js to something like:
WshShell.SendKeys("^{esc}cmd /C "cd %userprofile% & batchfile.bat"^+{ENTER}");
/C switch tells it to run the commands, then close the command-line window.
/K would leave the command window open after it exited the batch file.
To help you understand the SendKeys commands:
+=[Shift Key]
^=[Control Key]
{esc}=[Escape Key]
{enter}=[Enter Key]
To learn more about using CMD.EXE, type CMD /? at the command prompt.
This is a very untidy and ugly way to do it, but it's the only way I know how using only the tools that come with Windows.

Command line installer issues

Am attempting to run installer using command line using -c option.
Command line execution appears like this:
E:\dev>MyApp_32.exe -c
E:\dev>This will install App on your computer.
OK [o, Enter], Cancel [c]
E:\dev> (showing the Windows command line is confusing to user)
Welcome .. (text of 2nd screen)
Typing "c" or "Cancel" doesn't work. It always takes enter key as input and proceeds to next screen.
Pressing enter transfers control back to windows's command shell, then back to installer. This looks confusing to user. It doesn't give a unified experience to user.
Is it possible to provide input via a silent file ? i.e. a text file with pre-selected inputs?
Am using 32 bit installer on Win 7 Professional x64 with Java 1.6 installed.
The problem is that the installer is a GUI application, it cannot take control of a WIndows terminal in this way. If you start it via
start /wait MyApp_32.exe -c
the command line prompts will not be displayed.
You can run set a response file with the -varfile argument, see the help for more information.