How to execute a script just by double clicking like .EXE files in Windows?


I had the same problem this morning, searched a bit, and create a static class from the available knowledge. It solves the problem for Windows, but users of other systems should be able to easily add what's necessary - I just didn't know the correct system command (if there is one). I left the printEnvironmentInfo() method in for assistance.

What it does:

It enables double-click start for standard Java console applications without altering the operating system or creating files. The procedure is this:

It just returns in case you are in the IDE.

It just returns in case you have a console.

It starts the currently running .jar file in a new console and EXITS.

How to use:

Create Java console application.

Create class file AutoRunFromConsole and paste the below code under the package statement, replacing everything.

As (one of) the first statement(s) in your main method, do AutoRunFromConsole.runYourselfInConsole(true);...

0 0

This question already has an answer here:

I have tried right clicking on the file selecting properties and then the permissions tab and setting it to execute. However, when I double click the file it opens in gedit. What do I do?

To run your script by double clicking on its icon, you will need to create a .desktop file for it:

[Desktop Entry] Name=My script Comment=Test hello world script Exec=/home/user/ Icon=/home/user/youricon.gif Terminal=false Type=Application

Save the above as a file on your Desktop with a .desktop extension. Change /home/user/ and /home/user/youricon.gif to the paths of your script and whichever icon you want it ot have respectively and then you'll be able to launch by double clicking it.

Specifically, for your situation, you need to do:

Create a script that runs mono LOIC.exe. To do so, create a new text file with these contents:

#!/bin/bash mono /home/logan/.loic/LOIC.exe

Save this as...

0 0

Not exactly a solution. But you can use the below work around(depending on what exactly you are trying to achieve.)

Instead of running the C program from terminal you can create a desktop icon in ubuntu to click and run the program. I have used a simple python program for example, you can use C with slight modification to command and path of the program.

Step 1: Navigate to Desktop Folder.

Step 2: Create a file .desktop

Step 3: Paste the below contents.(modify accordingly)

#!/usr/bin/env xdg-open [Desktop Entry] Version=1.0 Type=Application Terminal=false Exec=python /home/neo/Documents/ Name=Click here to run Comment=comment here Icon=

change Exec= .

Step 4: Give appropriate permissions to both, C program and to .desktop file.

chmod 777

Step 5: Click and run the program.

Edit suggested by Gaurav Chauhan :

Reference for other ways to achieve this :- How to execute a script just by double clicking like .EXE...

0 0

First of all, /usr/bin/mono-service.exe does not exist.

Next, according to your posted link. Your script should read something like this:

#!/bin/sh /usr/bin/mono /usr/lib/mono/4.5/mono-service.exe ./AudioRecorder.exe "$@"


#!/bin/sh /usr/bin/mono-service ./AudioRecorder.exe "$@"


#!/bin/bash mono ./AudioRecorder.exe "$@"


#!/bin/sh /usr/bin/mono ./AudioRecorder.exe "$@"

However, these will only work if the exe file is in your home folder and ideally should include the actual path to the exe file such as the following if the exe file is in your home folder:

#!/bin/sh /usr/bin/mono /usr/lib/mono/4.5/mono-service.exe ~/AudioRecorder.exe "$@"


#!/bin/sh /usr/bin/mono-service ~/AudioRecorder.exe "$@"


#!/bin/bash mono ~/AudioRecorder.exe "$@"


#!/bin/sh /usr/bin/mono ~/AudioRecorder.exe "$@"

Alternatively, if the file is in your Downloads folder:

#!/bin/sh /usr/bin/mono /usr/lib/mono/4.5/mono-service.exe...
0 0

I am trying to make a .command script that will call another script. So whenever I double-click that script, it should launch another one.

source /bin/

Whenever I double click that file, it invokes that script without any problem. But after all commands are executed, it is logging out.

logout [Process completed]

I have also noticed this whenever i open .command file:

~/name.command ; exit;

I have made menu with aliases, So for example whenever user types in "Name" in console, it opens

Is there any way I can launch that script with double-clicking? So script will not log out after all commands are done. It doesn't close window, it just simply logs out from window, and then i can't access shell anymore.

Afaik OS X will only close the opened terminal if the command successes, so adding exit 1 to your file should do the trick:

if something; stuff1 else; stuff2 fi # Make sure the exit with error to prevent terminal closing...
0 0

I think the root of your problem is that you don't really understand the distinction between a Terminal Emulator and a Shell and how Linux figure out how to start processes.

First, there is the "Terminal Emulator", in Gnome-based environment this is usually Gnome Terminal.

Then there is the "Shell", in Linux this is usually bash, although other shells are possible.

A "Shell" runs inside a "Terminal Emulator". This distinctions comes from the age of physical terminals, where a physical Terminal is the hardware that takes input, writes text in colors, etc and the Shell is a software that processes user command and manage other processes based on the given commands.

Nowadays, we have a general purpose screen that can display any images, so we no longer use a physical Terminal, but instead have "Terminal Emulators", a software that emulates the job of a physical terminals, and the Shell, which is still the same ole' shell as previously (well, modern shells...

0 0

I have recently installed CS-Script, a scripting system for C# (as well as VB.NET, C++/CLI and J#).

CS-Script allows you to write a program in standard C# syntax (or in other languages supported by CS-Script) and run it without first compiling it to an executable! In this way, CS-Script offers the benefits of Windows Script Host (WSH) and other scripting frameworks and languages.

By default, when you double-click a .cs file, CS-Script is configured to to open it with Notepad. Instead, I actually wanted to change this so that double-clicking the .cs file would run the script. I was able to make this change by running the CS-Script configuration program css_config.exe, and under Open (double-click action), selecting .

Now, a question: There is one more thing I want to do--I'd like to be able to put a .cs file somewhere in my system path and run it like any other standard Windows executable. (For example, .exe, .bat and .cmd files.) Is this is...

0 0


Main version of Ruby we'll be using in this book is 2.2.1, so that's the first version we will install. Go to download section of RubyInstaller site and download Ruby 2.2.1-p85 installer. Double click on the downloaded executable file (rubyinstaller-2.2.1.exe) and follow instructions on the screen. However there are few things you must pay attention to.

It is recommended to install Ruby on the path without spaces. By default installer offers you to install Ruby to C:\Ruby22. You can change this path to suite your needs but be aware of the fact that MinGW tools, needed for instaling some types of gems (which we will cover later), do not handle paths with spaces well so you might face various problems if you install Ruby to standard Windows location C:\Program Files. We will install it in C:\Ruby\22 since we will keep all versions in the same root directory.

Next important thing is to add Ruby executables to the path. This way you will be able to...

0 0

How to execute Python scripts in Windows?

When you execute a script without typing "python" in front, you need to know two things about how Windows invokes the program. First is to find out what kind of file Windows thinks it is:

C:\>assoc .py .py=Python.File

Next, you need to know how Windows is executing things with that extension. It's associated with the file type "Python.File", so this command shows what it will be doing:

C:\>ftype Python.File Python.File="c:\python26\python.exe" "%1" %*

So on my machine, when I type " foo", it will execute this exact command, with no difference in results than if I had typed the full thing myself:

"c:\python26\python.exe" "" foo

If you type the same thing, including the quotation marks, then you'll get results identical to when you just type " foo". Now you're in a position to figure out the rest of your problem for yourself.

(Or post more helpful information in your...

0 0
0 0
Post by Python

But more importantly, practically speaking, it still doesn't really

provide much more help to the OP than Lawrence's answer.

I wasn't responding to the OP, I was responding to Lawrence. If I had a

solution for the OP beyond what others have already said (especially Thomas

Jollans' link to an AskUbuntu post), I would have given it.

Practically speaking, your responses to me don't help the OP either, do they?
So why single me out for criticism for *exactly* the same thing that you
yourself are doing?

Post by Python

He may well

know already that the desktop environment is what does the job (and

probably does even, in broad terms, if he's familiar with computers in

general), but have no idea how to configure it.

Anything is possible, but if he were that clueful, he would know that this has

nothing to do with Python and he should be asking in a forum dedicated to...

0 0

A lab environment is what Apple Remote Desktop software was designed for.

If you do not want to get Apple Remote Desktop, you could use ssh keys stored in the root account for all the Macs

from your control account on your Mac

ssh-keygen -t rsa # you can Google setting up ssh keys and find lots of hits

# also look for putting ssh key passphrase into your keychain

Append the $HOME/.ssh/ file to each of the classroom Mac's /var/root/.ssh/authorized_keys file.

If there is not /var/root/.ssh directory, then

sudo mkdir /var/root/.ssh

sudo chown root:wheel /var/root/.ssh

sudo chmod 500 /var/root/.ssh

sudo touch /var/root/.ssh/authorized_keys

sudo chown root:wheel /var/root/.ssh/authorized_keys

sudo chmod 644 /var/root/.ssh/authorized_keys

Now you can append the from your Mac into the authorized_keys file

Once you have your contents...

0 0

Welcome to the Best Auto Mouse Clicker page where you can find all the information required to Automate Mouse Clicking, Keystroke Pressing and everything else which requires lots of human efforts. The Software presented here is Auto Mouse Click which can do Repetitive Mouse Clicking with configurable time delay, configurable sequence of Mouse Clicks, can Click in Games and can do much more. This is definitely the Best Auto Mouse Clicker Application which lets you create a Mouse Clicking Script and run it as many times as you want. This Mouse Clicking Application has become better and better with inputs from users and has been developed to the highest possible software standards.

Best Auto Mouse Clicker

This Best Auto Mouse Clicker supports all types of Mouse Clicking (e.g. Left Click, Middle Click, Right Click, Double Click, Ctrl + Click, Shift + Click, etc), Mouse Movement (Mouse Movement with Animation, Mouse Movement by Offset or Direct Mouse Movement from one...

0 0

Need a little help figuring out what's going on with my program/vb6...
I was trying to shell a shutdown command which was erroring out on me so i bumped the shutdown to a .bat

the .bat worked fine as planned it shutdown the computer but when I tried to shell the .bat from vb6 the cmd window came up ran the shutdown command and gave me the following error message:

"shutdown is not recognized as an internal or operable command..." etc.

why is that and how do i fix it?

PC is an xp64 pro sp2

any help I can get will be much appreciated thanks a ton!

Last edited by benjaway; Jun 23rd, 2009 at . Reason: to save on read time I'm close to understand your problem, but can you provide a sample code? Specify the full path to shutdown.exe in your bat file. I don't think this is an issue. Every line in a bat file is executed by the OS. It looks...
0 0
Close and exit batch files

or How to close batch files

Even our favorite batch files will, at some time, need to quit.
Sometimes they need to quit based on a condition that has been or has not been met. And every batch file needs to quit, and will do so, when it reaches the last line of code.

There are several ways to end batch file execution, like reaching the end of the batch file, starting execution of another batch file, or using the EXIT or GOTO:EOF commands.

Each operating system may react in its own way to any of these events.
And often there is a difference between ending batch file execution and closing the batch file's console (window).

Reaching the end

After the batch file has executed its last line of code it will stop running, unless the last line contained a GOTO command forcing it to re-execute some of its previous code.

When the batch file stops running it will return control to the command...

0 0