Make a volume read-only (VBScript)
This code can be found in
Chapter 7 of Windows XP Cookbook
Purchase XP Cookbook or Networking Recipes for only $25 plus shipping! While supplies last.
Find out how to download all of the VBScript code from this site.
' From the book, "Windows XP Cookbook"
' ISBN: 0596007256
' ------ SCRIPT CONFIGURATION ------
strDrive = "<Drive>" ' e.g. e:
' This assumes writeprot is in your PATH, if not, fully qualify
' the path to the command (e.g. c:\bin\writeprot.exe)
strCommand = "writeprot /vol " & strDrive & " /ro"
' ------ END CONFIGURATION ---------
set objWshShell = WScript.CreateObject("WScript.Shell")
intRC = objWshShell.Run(strCommand, 0, TRUE)
if intRC <> 0 then
WScript.Echo "Error returned from running the command: " & intRC
WScript.Echo "Command attempted: " & strCommand
else
WScript.Echo "Command executed successfully."
end if
|
This code has been viewed 1139 times.
|
New from the creators of TechTasks.com:
StatSheet.com
|