Batch file that doesnt run - batch-file

I have creted a batch file that I want to run the SetupCodeGroup.exe
When I double click the batch file it doesnt run the exe file. A command prompt opens up but it doesnt run the file. Can someone tell what I missed or what I am missing
C:\Users\raw008\Desktop\Critcare\SetupCodeGroup.exe

type pause on the next line and check whether this executable comes on the command prompt .
try
start C:\Users\raw008\Desktop\Critcare\SetupCodeGroup‌​.exe
moreover
start /d "path_to_file_directory" program.exe
is the complete line to execute program and console will not wait to program to exit .

I wonder if this exe requires administrative privileges. Try right-clicking the batch file and running it as administrator.

#echo off
start C:\Users\raw008\Desktop\Critcare\SetupCodeGroup‌.exe
echo Done
pause
try that if that dose not work then your computers privleges are messed up, i ran into the same problem on my cousins computer.

Related

How to make batch file to run exe file which requires some text

I need to run 'a.exe'.
When I start 'a.exe' file, a console pops up, and I should type "go", then the program start.
If i want to make a batch file to run this program, how should i make this.
I tried as below:
///////////
%~d0
cd %~dp0
start a.exe > "go"
pause
///////////
but "go" appears on the batch console, and the "a.exe" program still requires "go" text.
How can i solve this?
Assuming you are coding a windows .bat script, you can execute any file by just passing the file with its path and its argument on the same line a.exe go, so your script would be something like this:
#echo off
c:\path\to\file\a.exe go
PAUSE
I am turning off CMD echo so the output of a.exe is easier to be read.
There is another question here were this is further explained: Create a batch file to run an .exe with an additional parameter.
On the other hand, if you need to call another script, you would need to use the method call
#echo off
call c:\path\to\other\script\script.bat
c:\path\to\file\a.exe go
PAUSE
You can use:
start echo go| a.exe
Just type in
a.exe go
Hope it helped you out.
You can also use it to run files through certain programs
photoshop img.png

Installing exe through batch file

I am trying to install through batch file..
ECHO OFF
ECHO Installing MySoftware . . .
"%~dp0\MySoftware.exe" /S /v/qn"UPGRADEADD=link goes here"
pause
but it fails to install.
Not much info to go on. What you have will not work if executed from a UNC drive and may not work if you 'Run as administrator' because the current directory gets changed. Try this. Of course that may not fix it and further details would be nice.
#ECHO OFF
PUSHD "%~dp0"
ECHO Installing MySoftware . . .
"MySoftware.exe" /S /v/qn"UPGRADEADD=link goes here"
Adding to my answer based on comments provided.
Presumably your bat file is in the same folder as MySoftware.exe. If it takes that long, it sounds like the install is working. Try doing
"MySoftware.exe" /?
That may give you a help screen to tell you more about the arguments beng passed. Also, try what you are now doing without the /S (which probably specifies a "silent" install... which is why you don't see anything.
PART 1 - If you want to create a "Setup" File in batch.
Maybe it works, but this is will be very hard to you for done this program.
Let's call the EXE File "Game1:
I will recommend you to take all the Game1 file's code (Maybe you can use the program Notepad++ for do this) after you taked Game1's code do this like i writing here
Let's say that the code of Game1 is:
ABC
Copy the code, then go to the batch file.
The "Setup" file of Game1 HAVE to come with a empty EXE file.
You can make a empty EXE file with notepad - just save the file as:
Name.exe
Then you doing at the batch file script this thing:
set %something%=ABC
After you done this you adding this to the batch script:
Echo %something% >> Name.exe
Don't forget to name the EXE file at the name of the program / game.
And now, if this message didn't help to you, maybe you need to make a EXE from batch file.
PART 2 - If you want to make an EXE file of batch file.
Open the start menu of Windows and search this:
IExpress
Don't let the computer search for you the full name, its working only if you wtiting the full name.
After you search IExpress, click on "Activate Command".
Click on Next, Don't change the first options.
Click on "Extract files only" and click on Next.
Name the EXE program and click Next.
Stay on "No prompt." and continue.
Now you can display a program License. if you want do a txt file and choose the display option.
Add batch files and click Next.
click on the option you want and click Next.
If you want a finish message, click on display message and write the message.
Here browse where the EXE will be and choose your options, click Next.
click Next.
Wow that's was super-long! Hope I helped you!

Batch File Ending Prematurely

I have a batch file with the following commands (to set up a compiler):
del Yylex.java
jflex scanner.flex
del parser.java
java -jar java-cup-11a.jar parser.cup
However, for some reason, after the conclusion of jflex scanner.flex, the batch script ends and command prompt closes. If I just run that command separately, this does not happen. Does anyone know what's wrong?
Is jflex a batch file?
If so, try
CALL jflex ...
or
start /wait "" jflex ...
(well, actually - give it a whirl anyway, can't hurt...)
When bat is asked to run another batch, it merely transfers control to that other batch and has no idea of where to return. CALL or START gives it a ticket home...

Prevent batch file in CMD from closing without using Pause

Currently I want to run a batch file that fires the command git log and show me that log.
After that I need to be able to commit and view the status so this prompt may not disappear after a key press.
I've searched the net and the only answer people have is pause which close the prompt after a keypress.
Does anyone have the solution for me? Currently I made a shortcut to cmd.exe and made the target my folder, but I want to execute some commands also.
Thanks in advance.
This (below) tested OK in Windows 7. To exit the window it creates, type "exit" when done.
start cmd /K "cd \[the-target-folder] && git log"
Where:
[the-target-folder] you replace with your target folder
Note:
&& lets you run two commands on one line
/K is a parameter to the cmd shell program which which carries out the command specified by string and remains.

getting returned results after running .BAT file

when i run a .BAT file, it displays a message but immediately closes the window
how i can i force it to keep the window open so that i can see the message reeturned?
One way is to conclude the batch file with the
PAUSE
command.
You can also wrap it another batch file that calls the original and then pauses:
FOO.BAT
PAUSE
This also works for read-only batch files and compiled executables.
An alternative is to execute this bat file from an already opened command prompt (shortcut: Windows Key + R, type cmd, press ENTER)

Resources