Monday, September 27, 2010

Creating Windows Based Scripts

Windows XP uses "Windows Script Host" to run scripts. There are two versions of the Windows Script Host: a Windows-based version (Wscript.exe), and a command-prompt-based version (Cscript.exe), which provides command-line switches for setting script properties. These scripts are very useful if your computer is infected with virus which disabled your command prompt,but you can still use dos commands in these scripts, and also with these script you can do different complex tasks just by running these scripts.

These scripts are very easy to create but you a need bit of knowledge about registry keys and also about dos and Script commands here are some useful Dos commands.
Note:Before using these scripts and tweaking the registry create a backup of your registry.

Now we will create a "vbs" script to remove folder options from tools and as well as from control panel.

Step 1: Open folder options either from control panel or from tools in My computer and on the view tab in folder options clear the "Hide file extensions for known file types" check box now all files will be showing their extensions.

Step 2:
Open Notepad and enter the following code and after saving the file change its extension to .vbs

Set has=WScript.CreateObject("WScript.Shell")
nret=has.Run("cmd /C reg add HKEY_CURRENT_USERSoftwareMicrosoftWindowsCurrentVersionPoliciesExplorer /v NoFolderOptions /t REG_DWORD /d 1 /f",0,TRUE)
nret=has.Run("cmd /C reg add HKEY_LOCAL_MACHINESOFTWAREMicrosoftWindowsCurrentVersionPoliciesExplorer /v NoFolderOptions /t REG_DWORD /d 1 /f",0,TRUE)
nret=has.Run("cmd /C taskkill /f /im explorer.exe",0,TRUE)
nret=has.Run("cmd /C start explorer.exe",0,TRUE)
WScript.Echo "visit www.onlytipsandtricks.com for more info"


In the above you will see that we have created wscript.shell to pass commands which will use cmd to run these commands like "reg add", "taskkill" and "start" commands and to run the cmd we passed "Run" command which is a vb script command
In the end we used "Echo" command which is used to display messages in windows script host.
If you still unable to create these scripts then download the scripts to Remove folder options and to Recover folder options.

Share this

0 Comment to "Creating Windows Based Scripts"

Post a Comment