Creating a batch file

Hi there,

I am starting to create a batch file to perform multiple actions, however I am having a few issues...

1) How can I centre and underline the text I have at the top of the page.


@echo off


Echo Sam Batch file


2) I am going to have a few multiple choice questions to start with. How do I make each question and answer  different colour


What do you need help with? >> I would like this be double underlined as well as bold (prefer ally a different color)

1) Network

2) Security

3) Tools

4) Image

Each option above I would like to be different colour to the question. e.g. The Title "Sam Batch file" in red, the multiple questions in purple, the 4 attentional answers in blue  

After I create another multiple choice after you select the first option, I would like this to be a different colour too. However this just keeps lopping and I don't understand why.

I also have a continuous loop, when I go choose 1) Network and then 1a = Ipconfig, however how do I make it stop after a single run?

Would be quite nice to have a GUI side to this script, however not sure how this would work

I would also like all text to be neatly layed out, so it is nice to read

I will also be writing all actions to a txt file (or a protected CSV if possible)

If it is possible I would like to create a Documentation and a separate choice at the end, where they can request help. I would like the help request to be sent to a mailbox (Encrypted). And the documentation stored in a network / cloud location)

In the documentation form, I would like have a multiple text boxes stating what the documentation contains, what type sector, what operating system, the subject, the creator (automatically populated from their username / full name)

I would like the information to be saved to my Office 365 SharePoint really rather than on site, however I have no idea how SSL certificates would work with this.

I would like to be able to run Image commands, e.g. Capture, Import, Edit.

Is there any way I would also make it a boot command?

If you use a batch file is it easy to run Powershell commands?

Not sure what / if is possible..

I haven't ever made a PowerShell script, so that's all pretty new to me. However if anyone could help / has any advice

Thank you

Hi Sam,

I'm a C# developer, so I may be impartial. For what you're doing, I think a meager PowerShell script cannot do for the GUI side of things, and C# and the VS toolkit can do both a GUI application and console application.

Visual Studio 2017 is personally my route to go to if you want to build a GUI based application, which is called a Windows Forms Application, or you could also do a Windows Presentation Foundation based application (although the former is easier to get around), although you will have to get used to a new language, C#, either way.

I realize it would be taxing to learn a new language and get familiar with a new workflow, but for me personally, I think since you're on a fresh slate here, this would be perfect to start off with a versatile and powerful language.

If you're interested, here is Visual Studio 2017 Community (free version, all you need is your Microsoft account):

If you decide to go on this path with your scripting/programming endeavors, please do feel free to send me a personal message on Microsoft Community, so in the event that you need help with something C# or Visual Studio related, I will be able to assist.

Fortunately though, there is a wealth of information out there that can get you up to speed, like on YouTube or Stack Overflow (which helped me gain traction in my understanding), but again, I'm at a stone's throw.

That's my two cents, though. I wish you luck on your prospect.

Was this reply helpful?

Sorry this didn't help.

Great! Thanks for your feedback.

How satisfied are you with this reply?

Thanks for your feedback, it helps us improve the site.

How satisfied are you with this reply?

Thanks for your feedback.

You can do a lot of what you want in a "DOS" / Batch file, including some of the color requirements, but DOS is pretty basic. Writing PowerShell code is essentially the same as a Batch file, just a different, more complex set of commands.

Just to confirm, you are trying to create on only applet that prompts user for some imput then outputs

PowerShell is a lot more powerful than DOS and should be able to do everything you need, so I disagree with Ethan's suggestion of going to C. Sure it is an option, but requires installing a new programming language, it is probably overkill for what you want to do and PowerShell is free.

Your overall question is too big to answer. Either break it up into smaller pieces or do your own research. Here are some links to get you started:

When to a Build a GUI for your Scripts
March 1, 2016
PowerShell is a shell language by nature. This means it was designed for the command-line. 95% of the PowerShell scripts you are building today are most likely executed from the PowerShell console in some way. However, did you realize that you can build professional-looking GUIs from within PowerShell? I’d like to over some considerations of when you might choose to create a GUI rather than a command-line tool.

Definitely take a look at this series of articles. It will probably answer many of your questions:

Learning GUI Toolmaking Series

Scripting is one thing, but to make your tools really pop, you’ll eventually want to build your own Graphical User Interface for end-users to use, especially those who might be frightened of using a scripting environment like PowerShell. In this series, I’ll take you step by step, from creating a GUI using built-in .net methods like System.Windows.Forms to the super quick, super effective XAML/WPF approach, using Visual Studio. As time goes on and I post more and more about GUI Toolmaking, this post will always be updated with the newest links

This tip is an example outputs possible from PowerShell (not specific to your question)
OUTPUTS- Generate a server uptime HTML report with PowerShell
Sitaram Pamarthi Fri, Sep 21 2012 powershell 15
The PowerShell script discussed in this post will ping a list of servers and get their uptime in HTML...Read more

OUTPUTS- HTML- Creating Simple PowerShell HotFix HTML Reports June 20, 2016 by Jeff Hicks
Looking to learn how to create simple PowerShell hotFix HTML reports? Jeff Hicks has you covered with a new tutorial that will help any IT Pro master this powerful feature. ConvertTo-HTML Get-MyHotFix

OUTPUTS- HTML- It's In the Mail Part 1: Sending PowerShell Data via E-Mail
By Jeffery Hicks 06/04/2013
It is very easy to get a lot of information out of PowerShell. But sometimes it isn't as easy to get it where it needs to be. One solution is e-mail. Everyone has it so why not send data pulled from PowerShell via an e-mail message? It is very easy with the Send-MailMessage cmdlet. These are plain text messages

Part 2: Sending Rich Messages by Jeffery Hicks
Part two will focus on how to send HTML messages through PowerShell

OUTPUTS- HTML- Use Markdown with PowerShell
In this article, you’ll learn what Markdown is, how to use it, and why it’s an important tool for the PowerShell administrative scripter.
Back in 2004, a blogger named John Gruber wrote a Perl script called Markdown that automated text-to-HTML conversions for web content creators. John released Markdown under a BSD-style open-source license.
The good news is that we PowerShell administrative scripters can easily add Markdown syntax to our toolset and make good use of the language on GitHub.

Make Your PowerShell Scripts Talk Back
Being able to receive real-time feedback as you work is a huge factor in writing script that won't break. 01/08/2015

More PowerShell Coloring Tips for Domain Controller Statuses January 26, 2016 with Jeff Hicks
PowerShell MVP Jeff Hicks shows you how to build an advanced highlighting function that should work for any command.

Multiply PowerShell Strings to Customize Text Underlines The Scripting Guys .... on 29 Jan 2012
Create a Windows PowerShell function that accepts pipelined input and creates a variable length underline that uses various characters

PowerShell Anger Management by Jeffery Hicks
Here's how to make those warning messages in PowerShell more visually appealing.

******************* Optional Reading *******************
Outside scope of your question, but examples of what you can do in PowerShell

OUTPUTS- Make a Marquee ScriptingGuy1 on 23 Oct 2010
Learn how to display output as moving text by using Windows PowerShell and easy to use techniques....
It's not the destination,
it's the journey.
Sometimes, though,
it's the mosquitoes.

Larson, Farside.

Was this reply helpful?

Sorry this didn't help.

Great! Thanks for your feedback.

How satisfied are you with this reply?

Thanks for your feedback, it helps us improve the site.

How satisfied are you with this reply?

Thanks for your feedback.


Question Info

Last updated July 30, 2018 Views 936 Applies to: