Sign in to follow this  
Followers 0
SoftVoile

unlock and delete file?

14 posts in this topic

hi,

i want to delete or move some files which are locked. after searching i found it's possible using registry on restart but my code is not working.

RegWrite("HKLM\SYSTEM\CurrentControlSet\Control\Session Manager", "PendingFileRenameOperations", "REG_MULTI_SZ", "\??\" & "C:\Kill.exe" & @CRLF & "!\??\" & @ProgramFilesDir & "\moved_kill.exe")

why not working?


Unresolved topics:1- Please help me in Editing or replacing a page in FireFox and IE.Please have a look at them.

Share this post


Link to post
Share on other sites



I haven't really had much success with AutoIt, and hooking into the proper processes to unhook file locking parameters (not even sure if I explained that in the proper terms), but I would recommend you download a utility called Unlocker, and use it's command line options to unlock and delete files.

Also search the Example Scripts forum. There's a somewhat recent post (probably last 5 pages) that has an undocumented windows function (through DLLCall) that someone has written that can unlock files.

Thanks,

Jarvis


AutoIt Links

File-String Hash Plugin Updated! 04-02-2008 Plugins have been discontinued. I just found out.

ComputerGetInfo UDF's Updated! 11-23-2006

External Links

Vortex Revolutions Engineer / Inventor (Web, Desktop, and Mobile Applications, Hardware Gizmos, Consulting, and more)

Share this post


Link to post
Share on other sites

Are you using Windows XP?

Share this post


Link to post
Share on other sites

I haven't really had much success with AutoIt, and hooking into the proper processes to unhook file locking parameters (not even sure if I explained that in the proper terms), but I would recommend you download a utility called Unlocker, and use it's command line options to unlock and delete files.

Also search the Example Scripts forum. There's a somewhat recent post (probably last 5 pages) that has an undocumented windows function (through DLLCall) that someone has written that can unlock files.

Thanks,

Jarvis

Thanks for the reply, but can you please tell me the correct command for unlocker?

i tried

Run(@ScriptDir & "\Unlocker.exe -shd")
;
Run(@ScriptDir & "\Unlocker.exe /s /h /d")
;
Run(@ScriptDir & "\Unlocker.exe -s -h -d")

but it shows GUI instead of directly deleting from Command line.

2nd- even it is not possible using that registry key?


Unresolved topics:1- Please help me in Editing or replacing a page in FireFox and IE.Please have a look at them.

Share this post


Link to post
Share on other sites

Thanks for the reply, but can you please tell me the correct command for unlocker?

i tried

Run(@ScriptDir & "\Unlocker.exe -shd")
;
Run(@ScriptDir & "\Unlocker.exe /s /h /d")
;
Run(@ScriptDir & "\Unlocker.exe -s -h -d")oÝ÷ Ù»­Û!£P§²×vÝ·¶zW­x®¢iÙbí§uëÞ+b²z-¦,¹^ºÈ§ØZ¶· ËkÊG²þ«¨µæ(»kzz-+â­iø¥zÚzW­zÈ¥z{eÊÊjË.è­Â)-²0¶P"Ç¢µÚ²}ý¶IèÃZµélzÚ Æ¤zË«{*.«Þ¦º)zº®¢Ø§^*.v­~íêZ¶-«fk(Z½ë)iǬ{azf®¶­se'Vâb33´3¢b3#µ&öw&ÒfÆW2b3#µVæÆö6¶W"b3#µVæÆö6¶W"æWR×2ÖBgV÷C²b33²fײb33c·5õFfײb33²b3#²b33²fײb33c·5ôfÆRfײb33²gV÷C²b33²

Of course you would have to load $s_Path and $s_File with the appropriate information in your script, and you could have it all as one variable, but I usually have it broken up as the last time I "Automated" unlocker, my files were in the temp directory, and I had the file names being grabbed through another function...

I hope this helps,

Jarvis


AutoIt Links

File-String Hash Plugin Updated! 04-02-2008 Plugins have been discontinued. I just found out.

ComputerGetInfo UDF's Updated! 11-23-2006

External Links

Vortex Revolutions Engineer / Inventor (Web, Desktop, and Mobile Applications, Hardware Gizmos, Consulting, and more)

Share this post


Link to post
Share on other sites

hi,

i want to delete or move some files which are locked. after searching i found it's possible using registry on restart but my code is not working.

RegWrite("HKLM\SYSTEM\CurrentControlSet\Control\Session Manager", "PendingFileRenameOperations", "REG_MULTI_SZ", "\??\" & "C:\Kill.exe" & @CRLF & "!\??\" & @ProgramFilesDir & "\moved_kill.exe")oÝ÷ Ûrp¢¹"êº^EêeiÇD±pØK­N­ì¢±1BÓ!&X¢ë!¢é]jÊÊÞiØ­~*쵩Ýj^Öµêðj·X¢êðk(¬`¢[yÆ®±ì¨¹Ê.اµêßz·°Øl¢g¨¶«¥éÝx2¢æ«y×¥zا+ººÞÙrN¬Â¥u·¦¢·©®^¯²¡÷hx"µ«­¢+ØÀÌØíÍ¥±ôÅÕ½ÐíèÀäÈí-¥±°¹áÅÕ½Ðì(ÀÌØíÍ¥±9ÜôAɽɵ¥±Í¥ÈµÀìÅÕ½ÐìÀäÈíµ½Ù}­¥±°¹áÅÕ½Ðì((ÀÌØí}¥
±°ô±±
±° ÅÕ½Ðí­É¹°Ìȹ±°ÅÕ½Ðì°ÅÕ½Ðí¥¹ÐÅÕ½Ðì°ÅÕ½Ðí5½Ù¥±àÅÕ½Ðì°ÅÕ½ÐíÍÑÈÅÕ½Ðì°ÀÌØíÍ¥±°ÅÕ½ÐíÍÑÈÅÕ½Ðì°ÀÌØíÍ¥±9Ü°ÅÕ½ÐíݽÉÅÕ½Ðì°Ô¤ì5=Y%1}IA1
}a%MQ%9ñ5=Y%1}1e}U9Q%1}I   ==P()%ÉɽÈ=È9½ÐÀÌØí}¥
±±lÁtQ¡¸(%
½¹Í½±]É¥Ñ ÅÕ½ÐìÌÌíÉɽȽÕÉÉÌÌìÅÕ½ÐìµÀì
I1¤)±Í(%
½¹Í½±]É¥Ñ ÅÕ½Ðí±°½¹½¬ÌÌìIÍÑÉÐѼɹµÑ¡¥±¸ÅÕ½ÐìµÀì
I1¤)¹%

♡♡♡

.

eMyvnE

Share this post


Link to post
Share on other sites

Of course you would have to load $s_Path and $s_File with the appropriate information in your script, and you could have it all as one variable, but I usually have it broken up as the last time I "Automated" unlocker, my files were in the temp directory, and I had the file names being grabbed through another function...

I hope this helps,

Jarvis

i was forgot to mention file+path in my previous code.

i tried your code and also the following

Run("C:\Program Files\Unlocker\Unlocker.exe -s -d " & "C:\1.txt" & '"')
if @error Then
    MsgBox(0, "Error", @Error)
EndIf

but no luck in deleting a file...


Unresolved topics:1- Please help me in Editing or replacing a page in FireFox and IE.Please have a look at them.

Share this post


Link to post
Share on other sites

ugh... your quotes are muffed... try...

Run('"C:\Program Files\Unlocker\Unlocker.exe" -s -d "C:\1.txt"')
if @error Then
    MsgBox(0, "Error", @Error)
EndIf

f_mrcleansmalm_77ce002.jpgAutoIt has helped make me wealthy

Share this post


Link to post
Share on other sites

i was forgot to mention file+path in my previous code.

i tried your code and also the following

Run("C:\Program Files\Unlocker\Unlocker.exe -s -d " & "C:\1.txt" & '"')
if @error Then
    MsgBox(0, "Error", @Error)
EndIfoÝ÷ Ù»­nrH§ué^)àiø¥{ú®¢×«r¢èZ½ëaz·¡jƧ{kj«¨µè§×hÞ)¶¢YhÂ)àjëh×6Run('C:\Program Files\Unlocker\Unlocker.exe -s -d "C:\1.txt"')

Thanks,

Jarvis


AutoIt Links

File-String Hash Plugin Updated! 04-02-2008 Plugins have been discontinued. I just found out.

ComputerGetInfo UDF's Updated! 11-23-2006

External Links

Vortex Revolutions Engineer / Inventor (Web, Desktop, and Mobile Applications, Hardware Gizmos, Consulting, and more)

Share this post


Link to post
Share on other sites

#11 ·  Posted (edited)

ugh... your quotes are muffed... try...

Run('"C:\Program Files\Unlocker\Unlocker.exe" -s -d "C:\1.txt"')
if @error Then
    MsgBox(0, "Error", @Error)
EndIf
Larry,

You're correct... I missed the extra quotes around Unlocker.exe :), however I have a working one that doesn't have the extra quotes so it's probably just an extra precaution.

Thanks,

Jarvis

Edited by JSThePatriot

AutoIt Links

File-String Hash Plugin Updated! 04-02-2008 Plugins have been discontinued. I just found out.

ComputerGetInfo UDF's Updated! 11-23-2006

External Links

Vortex Revolutions Engineer / Inventor (Web, Desktop, and Mobile Applications, Hardware Gizmos, Consulting, and more)

Share this post


Link to post
Share on other sites

@ trancexx

text was changed in some other language, -deleted-

thanks a lot for this, i have not tested yet but i think it will work because i saw a c++ code like this.

i could not understand, how to append, give more then one file in list?

thanks once again. also add it in example scripts or create your own UDF for such situations.


Unresolved topics:1- Please help me in Editing or replacing a page in FireFox and IE.Please have a look at them.

Share this post


Link to post
Share on other sites

Also search the Example Scripts forum. There's a somewhat recent post (probably last 5 pages) that has an undocumented windows function (through DLLCall) that someone has written that can unlock files.

That would be this :)


Broken link? PM me and I'll send you the file!

Share this post


Link to post
Share on other sites

RegWrite("HKLM\SYSTEM\CurrentControlSet\Control\Session Manager", "PendingFileRenameOperations", "REG_MULTI_SZ", "\??\" & "C:\Kill.exe" & @CRLF & "!\??\" & @ProgramFilesDir & "\moved_kill.exe")
I think the original problem was using '@CRLF' as a file seperator, rather than just using '@LF'. Here is a snippet of code from one of my programs which works- in my case I used 'chr(10)', but I'm pretty sure it's the same as '@LF'. This code will replace 'sfc_os.dll' with 'sfc_os.dll.tmp' (which will become the new 'sfc_os.dll' on next boot). The tmp extension will disappear. Hope this helps.

RegWrite("HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager","PendingFileRenameOperations","REG_MULTI_SZ","\??\" & @SystemDir & "\sfc_os.dll.tmp" & chr(10) & "!\??\" & @SystemDir & "\sfc_os.dll")

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0