This is just a simple glimpse into how I use Bash scripts and/or PowerShell scripts on my Windows 10 machine to automate my workflow and do more than one thing at a time.

I normally start my console emulator, cmder, as a Bash admin, but sometimes, I open a new tab as a PowerShell admin.

As you can see from the above image, I wrote the following scripts to quickly set me up for work:

  1. change my directory from the cmder to one of my destination work folders: my product reviews, local git repositories, and nodejs development folder.
  2. open the destination folder in Sublime
  3. open the destination folder in Windows Explorer
  4. show the path to the current (which was also the destination) folder

Here is the simple PowerShell script:

to run it on cmder, I just type:

gotoreview.ps1

Here is the simple Bash script:

to run it on cmder, I just type:

source gotoreview.sh

or

. gotoreview.sh

Notes: When running the Bash version of the program from cmder, always precede the filename with “source” or a “.” in order for change directory to work. Without it, the sublime command will run and windows explorer will open, but on you will not change directory to your TARGET folder. See the images below:

Incorrect:

Correct:

Further Learning

There are lots of websites that can help you learn either Bash or PowerShell scripting:

For PowerShell:

  1. Microsoft Documentation Page
  2. Another Microsoft PowerShell Documentation
  3. A PowerShell Primer article written by Jonathan Hassell for ComputerWorld.com

For Bash Scripting:

  1. Bash Beginners Guide by Machtelt Garrels
  2. Advanced Bash Scripting Guide by Mendel Cooper
  3. Udemy Courses

If you are interested in cmder, a powerful, portable console emulator for Windows, visit their site on cmder.net.