Connect with OliverSK on about.me and twitter.com/oliversk | extension Get Our Chrome Extension

How to write scripts in Windows 7

Written by: Uttam Shrestha - Published: Sunday, July 24th, 2011

In this tutorial, we are covering both PowerShell basics and batch basics. First let’s deal with PowerShell scripting. To write scripts in Windows 7, follow the steps provided in this tutorial.

Ads:

preview-how-to-write-scripts-in-windows-7

Steps to write scripts in windows 7

1. Step First let’s open Windows PowerShell Integrated Scripting Environment (ISE), where you can write scripts. Alternatively, you can simply write in notepad and save as .ps1 extension. Click on the Start and type powershell in the ‘Search programs and files text box’. Then click Windows PowerShell ISE.

step-1-how-to-write-scripts-in-windows-7

2. Step Now, Windows PowerShell Integrated Scripting Environment (ISE) opens

step-2-how-to-write-scripts-in-windows-7

3. Step Now we are typing a basic script. To check processes that is running in your Windows 7, type Get-Process. For more instructions, examples on PowerShell scripting visit http://www.computerperformance.co.uk/powershell/

step-3-how-to-write-scripts-in-windows-7

4. Step Click on the File >> Save.

step-4-how-to-write-scripts-in-windows-7

5. Step In the Save dialog box, give the file name. In my case, i gave a1 and click Save.

step-5-how-to-write-scripts-in-windows-7

6. Step Now to execute, the written PowerShell script, Click on the Start and type powershell in the ‘Search programs and files text box’. Then click Windows PowerShell.

step-6-how-to-write-scripts-in-windows-7

7. Step Then Windows PowerShell opens. Type the complete path along with file name and extension of the script that you have just created.

step-7-how-to-write-scripts-in-windows-7

8. Step Finally your script executes. Just incase, if you have problem executing script then there might be a permission issue. Please refer http://technet.microsoft.com/en-us/library/ee176949.aspx for editing permissions.

step-8-how-to-write-scripts-in-windows-7

9. Step Let’s go to the another part of the tutorial. We shall create simple batch to do some task automatically. To create a simple batch file, Click on the Start and type notepad in the ‘Search programs and files text box’. Then press enter or click notepad.

step-9-how-to-write-scripts-in-windows-7

10. Step Now notepad opens.We shall create a simple batch file to display files and folder inside c:\ drive in your Windows 7.
Type following:

dir c:\

pause

step-10-how-to-write-scripts-in-windows-7

11. Save the file by clicking File >> Save, give the file name. In my case, i gave testing.bat and click Save. Make sure you give extension as .bat otherwise it will be saved as text by default.

step-11-how-to-write-scripts-in-windows-7

12. Now locate the file and double click on it to open it.

step-12-how-to-write-scripts-in-windows-7

13. Finally, your batch file executes. That are the complete steps.

step-13-how-to-write-scripts-in-windows-7

Windows PowerShell is Microsoft’s task automation framework, consisting of a command-line shell and associated scripting language built on top of, and integrated with the .NET Framework. PowerShell provides full access to COM and WMI, enabling administrators to perform administrative tasks on both local and remote Windows systems.

Simiarly, a batch file is a text file which contains series of commands intended to be executed by the command interpreter in DOS, OS/2, and Microsoft Windows. Batch files are useful for running a sequence of executables automatically and are often used to automate repetitive or tedious processes.

 

Comments

comments


Trending On Windows 7 Themes .Net

Related Questions


Written by: Uttam Shrestha
Uttam is a Microsoft Student Partner from Kathmandu, Nepal. Aside from blogging, Uttam is also studying computer engineering and works as a freelancer developer. Windows has always been his first love. He has been using Windows since his early days since he was in 2nd Grade. He also used a few other operating systems but never found any other OS that he grew fond of.

Contact The Author: support@windows7themes.net Get Free Help.png

Connect With Our Site:

facebook google twitter


Need help? Ask a question at our QA site, click the red button to get started:

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

Current day month ye@r *