Can't find the information you are looking for here? Then leave a message over on our WinBatch Tech Support Forum.
For anyone wanting to use it with a run command and cmd here it is:
RunWait('cmd.exe', '/c cipher /e /a /s:c:\temp')to decrypt use a /d in place of the /e.
*OR*
;; May not be what you are looking for but here it is anyway. ;; Could be enhanced. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; EncryptFile - Encripts file using default context ;; ;; In - full file name. ;; ;; Return - Non-zero on success, zero on failure. ;; ;; Notes - Must have correct access rights to use. ;; - Does not error if file aready encrypted. ;; - Win2k or later. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; #DefineFunction EncryptFile( sFileName ) sAdvapi = StrCat(DirWindows(1),"Advapi32.dll") LastError() nErrorMode = ErrorMode(@OFF) bResult = DllCall(sAdvapi,long:"EncryptFileA", lpstr:sFileName) ErrorMode(nErrorMode) If !bResult ; Lazy error handling. Message("EncryptFile Error", DllLastError()) EndIf Return bResult #EndFunction ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; DecryptFile - Decrypts file using default context ;; ;; In - full file name. ;; ;; Return - Non-zero on success, zero on failure. ;; ;; Notes - Must have correct access rights to use. ;; - Does not error if file is not encrypted. ;; - Win2k or later. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; #DefineFunction DecryptFile( sFileName ) sAdvapi =StrCat(DirWindows(1),"Advapi32.dll") LastError() nErrorMode = ErrorMode(@OFF) bResult = DllCall(sAdvapi,long:"DecryptFileA", lpstr:sFileName, long:0) ErrorMode(nErrorMode) If !bResult ; Lazy error handling. Message("DecryptFile Error", DllLastError()) EndIf Return bResult #EndFunction sFile = "c:\temp\test.txt" bResult = EncryptFile(sFile) Message("Encrypt test", bResult) If bResult bResult = DecryptFile(sFile) Message("Decrypt test", bResult) EndIf
Article ID: W17251
File Created: 2007:07:03:14:29:00
Last Updated: 2007:07:03:14:29:00