Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to create an executable command prompt script

I usually perform actions in the 7zip command line program. I was thinking about creating a small script to do everything automatically, but I have never written any Windows shell script before and therefore don't even know where to begin.

I would like to make an executable script file which, when a user double-clicks on it, will call the 7zip command line and perform some actions.

First of all, is this possible? And if it is, what is the best way to do this?

like image 684
user1301428 Avatar asked Dec 20 '12 15:12

user1301428


People also ask

Which command will make a script an executable file?

Use chmod to make a script an executable program.

What is an executable script?

An executable script is an executable file of which the first two characters are #! as defined in the portable character set. In POSIX 1003.1-2001 (ISO/IEC 9945-2003), this construct is undefined, but reserved for implementations which wish to provide this functionality.


1 Answers

You can create a batch script to do this.

It's basically command line commands that run one after another so you don't have to keep typing them in :)

Put the commands you would normally use for 7zip in a notepad file and save it with the extension .bat, then run it.

7z blah blah params
7z more params and args

All your commands will be executed automatically when the previous one finishes.

There are other programming languages you could do this in (or even VBScript) but batch would be perfectly suited to this, and you don't need to install anything extra.

like image 129
Bali C Avatar answered Nov 02 '22 06:11

Bali C