Search Windows and Linux Networking

Wednesday, May 18, 2011

Create your own Library for Script


Create your own Library for Script

It is better to use our existing script that we have already created for some task. To avid to rewrite same code for same task in our new script just create your own library and just point the old script file for do specific task. I will show, how to create library and how to use it.

Open the command prompt and go to D drive with D:

Now create some folder hierarchy for our library

mkdir Scripts
cd Scripts
mkdir Includes
mkdir GroupScripts
mkdir UserScripts

Now Create simple “hello word “  VBScript file in D:\Scripts\Includes folder as “hello.vbs” for reference

Open notepad and type simple line

MsgBox “hello word”

And save file as “hello.vbs” in includes folder.

Now, we actually create Script file that we are actually going to execute.

Open notepad and type

<job>
<Script language="VBScript"src="Includes\test.vbs" />
<script language=VBScript >
Wscript.Echo "test"
</script>
</job>

And save the file as “sample.wsf” in main script folder D:\Scripts

Now execute the file sample.wsf . when it run. It do some task given in reference file for our example it take reference for hello.vbs and the do other task from main script. That’s it.

No comments:

Post a Comment