Add 'Take Ownership' to context menu (VBScript)

Introduction

The goal of this script is adding 'Take Ownership' to context menu in Windows 8.

Scenarios

In Windows 8, when you want to delete and copy some files and folders, it will show that "you do not have permission to delete or move it”. That is because you are not the owner of the file or folder. This script is to add 'Take ownership' to context menu so that you can easily change the owner to current user.

Script

Step 1: Press "Win" + X, and select "Command Prompt (Admin)".

Step 2: Enter the path of the VBScript with your choice.

If you want add 'Take ownership' to context, you can use command like this:  cscript.exe C:\scriptPath Add.

If you want add 'Take ownership' to context, you can use command like this:  cscript.exe C:\scriptPath remove.

Here are some code snippets for your references. To get the complete script sample, please click the download button at the beginning of this page.

VB Script
Edit|Remove
Function KeyExists(Path) 
    On Error Resume Next  
    Dim objshell,Flag,value 
    Set objShell = CreateObject("WScript.Shell") 
    value = objShell.RegRead(Path)  
    Flag = False  
    If Err.Number = 0 Then      
         Flag = True  
    End If 
    Keyexists = Flag 
End Function

Prerequisite

Windows 8