![]() |
![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() |
|
Welcome to Vista Forums we are your forum to discuss Windows Vista x64 and x86 systems. Whether you need help or just want to post an idea you have on Vista, this is the forum for you.
br> br> |
| |||||||
![]() |
| | Thread Tools | Display Modes |
| | #2 (permalink) |
| Guest | RE: Deleting a file in use If the file is locked open you won't be able to delete it from PowerShell during that session -- Richard Siddaway Please note that all scripts are supplied "as is" and with no warranty Blog: http://richardsiddaway.spaces.live.com/ PowerShell User Group: http://www.get-psuguk.org.uk "Ashish" wrote: > Is there any way in powershell to delete a file which is in use? > I tried move and delete and that didnt work.. Am looking at something in Win > API like MOVEFILE_DELAY_UNTIL_REBOOT |
| | #3 (permalink) |
| Guest | Re: Deleting a file in use Hi Ashish: > Is there any way in powershell to delete a file which is in use? You probably already know about it, but you might be interested in this tool: http://www.microsoft.com/technet/sys...pendmoves.mspx Cheers, Jason ------------------------------------------------------ PowerShell Training at SANS Conferences http://www.WindowsPowerShellTraining.com ------------------------------------------------------ |
| | #4 (permalink) |
| Guest | Re: Deleting a file in use Oh, and this too, there was a thread on this earlier in this group: http://ccollomb.free.fr/unlocker/ Cheers, Jason ------------------------------------------------------ PowerShell Training at SANS Conferences http://www.WindowsPowerShellTraining.com ------------------------------------------------------ |
| | #5 (permalink) |
| Guest | RE: Deleting a file in use i created a Pinvoke code which calls MoveFileEx API for the same...seems like it isnt happy taking values of long type. any ideas what may have gone wrong? $domain = [AppDomain]::CurrentDomain $name = New-Object Reflection.AssemblyName 'TestAssembly' $assembly = $domain.DefineDynamicAssembly($name, 'Run') $module = $assembly.DefineDynamicModule('TestModule') $type = $module.DefineType('TestType') [Type[]]$parameterTypes = [string], [string], [int64] $method = $type.DefineMethod("MoveFileeX", 'Public,Static,PinvokeImpl', [bool], $parameterTypes) $ctor = [Runtime.InteropServices.DllImportAttribute].GetConstructor([string]) $attr = New-Object Reflection.Emit.CustomAttributeBuilder $ctor, 'kernel32' $method.SetCustomAttribute($attr) $realType = $type.CreateType() [object[]]$args = [string]'F:\\dll\\abc.dll', [string]$null, [int64]4 $realType.InvokeMember('MoveFileeX', 'Public,Static,InvokeMethod', $null,$null, $args) "RichS" wrote: > If the file is locked open you won't be able to delete it from PowerShell > during that session > -- > Richard Siddaway > Please note that all scripts are supplied "as is" and with no warranty > Blog: http://richardsiddaway.spaces.live.com/ > PowerShell User Group: http://www.get-psuguk.org.uk > > > "Ashish" wrote: > > > Is there any way in powershell to delete a file which is in use? > > I tried move and delete and that didnt work.. Am looking at something in Win > > API like MOVEFILE_DELAY_UNTIL_REBOOT |
| |
| |
![]() |
| Thread Tools | |
| Display Modes | |
| |
Similar Threads | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| need help deleting a file? | bessiere | Network & Internet | 1 | 01-07-2008 01:10 PM |
| deleting a file | gursaran abott | Vista file management | 3 | 10-31-2007 08:32 PM |
| Error when deleting file, file is in use | Martin Weber | Vista file management | 3 | 07-17-2007 09:53 PM |
| Deleting file(s) | MagneX | Vista file management | 0 | 05-11-2007 03:23 AM |
| deleting hibernation file | chinga69 | Vista General | 7 | 09-28-2006 03:01 PM |