Martin
Martin

Reputation: 3472

How to encrypt files using EFS with vbscript?

Is it possible to programmatically encrypt files (with EFS) using vbscript. Are there any EFS API's that can be used with c# on windows 7?

Upvotes: 1

Views: 1587

Answers (2)

Jeremy Thompson
Jeremy Thompson

Reputation: 65682

I translated your answer to C#:

WshShell sh1 = new WshShell(); 
var retval = sh1.Run("CIPHER /E /S:" & strDir, 0, True); 

Upvotes: 1

Martin
Martin

Reputation: 3472

No answers yet !! meanwhile one option was to use the folowing script

Dim strDir, objShell, FSO, WshShell
strDir = "D:\TestFolder"
Set objShell = CreateObject("Shell.Application")
Set FSO = CreateObject("Scripting.FileSystemObject")
Set WshShell = WScript.CreateObject("WScript.Shell")
retval = WshShell.Run("CIPHER /E /S:" & strDir, 0, True)
MsgBox("Success")

Upvotes: 0

Related Questions