This is an improved script of @Alexandru's for Windows.
EDIT: Windows 8 will not properly run scripts with spaces in their names, it keeps asking for the program to open with at each and every execution. Spaces and quotation marks have been removed from file names and version bumped to 1.01.
<?xml version="1.0" encoding="utf-8"?>
<?job error="false" debug="false"?>
* Copyright 2012 XP1
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
/*jslint browser: true, vars: true, white: true, maxerr: 50, indent: 4 */
(function (script, shell, fileSystem)
var currentDirectory = fileSystem.getFolder(shell.currentDirectory);
currentDirectory.createTextFile("empty.txt", true, false).close();
}(this.WScript, new this.ActiveXObject("WScript.Shell"), new this.ActiveXObject("Scripting.FileSystemObject")));
This script creates an empty file at the root of the current directory.
Next, save this XML file as
<?xml version="1.0" encoding="utf-16"?>
<Task version="1.2" xmlns="http://schemas.microsoft.com/windows/2004/02/mit/task">
When you save the XML file, make sure that you save the file encoding as UTF-16 (labeled "Unicode" in Notepad).
<Command>"\KeepAwake101.wsf"</Command>, make sure that you modify this line by adding the location of the script.
<WorkingDirectory>L:\</WorkingDirectory>, you can change this line to the location of your drive.
Start > All Programs > Accessories > Right click on "Command Prompt" > Run as administrator.
Change to the directory where the XML file is located.
Import the XML as a task:
schtasks /create /tn "Keep Awake 1.01" /xml "KeepAwake101.xml"
If you want to delete the task, type:
schtasks /delete /tn "Keep Awake 1.01" /f
This task is set up to run every 20 minutes. My Western Digital Elements 2 TB (WDBAAU0020HBK) external hard drive sleeps every 30 minutes.
After you have imported the task, you can configure the interval and schedule by using the task scheduler. To open the task scheduler, in the command prompt or in a Start > Run dialog, type:
Western Digital Green drives may have an aggressive IntelliPark feature that parks the head after 8 seconds of inactivity. This will cause the load/unload cycle count (LCC) to increase substantially. You can check the LCC by using software, such as Defraggler or Hard Disk Sentinel on Windows, that can read S.M.A.R.T. data.
Keeping the drive awake every 20 minutes may eventually increase the LCC over the limit. Instead of running this script, you may consider only using the drive occasionally and leaving it unplugged.
You can read more here:
Although you could change the interval of the script to 7 seconds to prevent head parking, it doesn't sound very good.
It would be a good idea to use
wdidle3.exe to disable the IntelliPark feature or adjust the timeout.
If you don't want to do any of that, it would be a great idea to buy a different hard drive, and use the Western Digital Green hard drive as a backup drive that you only need to turn on occasionally. Everyone loves backups.