Difference between revisions of "Desktop scripting/bat files"

From Adam Meola - wiki
Jump to navigation Jump to search
Line 5: Line 5:
  
 
If your task can be done from the command prompt, those actions can be saved to a file, then played back later; simply by double clicking it!
 
If your task can be done from the command prompt, those actions can be saved to a file, then played back later; simply by double clicking it!
 
 
 
  
 
===Setting up an bat script===
 
===Setting up an bat script===
Line 18: Line 15:
 
: 4} Type and save whatever you'd like to run in the shell.
 
: 4} Type and save whatever you'd like to run in the shell.
 
:* seperate commands with " && "
 
:* seperate commands with " && "
 
 
  
 
===Using an bat script===
 
===Using an bat script===
Line 25: Line 20:
 
: double click the file you've created
 
: double click the file you've created
 
:* a command prompt will open and run the command(s) that you've put in the bat file.
 
:* a command prompt will open and run the command(s) that you've put in the bat file.
 +
 +
===Advanced usage===
 +
 +
sh scripts can of course do far more than this, and I may one day cover it.
 +
 +
For example, they can provide input to terminal commands that require USER input!
 +
 +
But for now, I leave you to https://www.google.com/

Revision as of 16:53, 2 September 2020

bat Files!

(available for windows)

Bat files are (possibly) the easiest way to automate a given task on windows.

If your task can be done from the command prompt, those actions can be saved to a file, then played back later; simply by double clicking it!

Setting up an bat script

1) cd to the folder where you'd like to save your script
2) run:
.>[nameYourFileHere].bat
  • this will create a blank plain text file of that name
3) Open the file you've just created in a text editor. (notepad, notepad++, Atom, vsCode, they're all fine)
4} Type and save whatever you'd like to run in the shell.
  • seperate commands with " && "

Using an bat script

double click the file you've created
  • a command prompt will open and run the command(s) that you've put in the bat file.

Advanced usage

sh scripts can of course do far more than this, and I may one day cover it.

For example, they can provide input to terminal commands that require USER input!

But for now, I leave you to https://www.google.com/