PowerShell: Using .bat file

Discovery

The one thing I always loved about .bat files is that you can just double click them.
So I use them to run my scripts for actions I use often.

Description

This .bat file opens a exectution prompt and starts a powershell script with the parameter -Test.
Because of the -noexit parameter it will not close the window once it is done. This is usefull if you have a script that generates output or if you want to read any error messages.

Example

@powershell -noexit -command ".\Add-Flavor.ps1 -Test"

You can just copy/paste this code into notepad, “Save As” giberish.bat and execute.

Advertisements

Tags: ,

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: