How to write scripts in Windows 7


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.

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

Steps to write scripts in windows 7

1. 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. Now, Windows PowerShell Integrated Scripting Environment (ISE) opens

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

3. 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. Click on the File >> Save.

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

5. 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. 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. 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. 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. 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. 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.

 


Or you might like these sexy wallpaper, tweaks and themes:

Written by Uttam Sunday, July 24th, 2011

Was it helpful? Please bookmark it and spread the word

delicious   facebook   google   twitter  

You love Windows, Gaming and everything digital? Great, we too! We have thousands of great Windows 7 themes, registry tweaks, tutorials, so please use our search box if you look for anything specific. If you have some awesome desktop themes, tips or want to write for us, then drop us a mail: win7themes at googlemail.com

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>