Home All Groups Group Topic Archive Search About

how to delete a file when the windows start

Author
2 Jul 2006 3:56 PM
paraidy
Hi, i'm new in this group and i need your help experts :) sometimes
some files are used by the system and is impossible to delete them, how
can i queue a file to delete it at next system startup before it is in
use? thx all.

Author
2 Jul 2006 4:17 PM
Herfried K. Wagner [MVP]
"paraidy" <samore***@tiscali.it> schrieb:
> Hi, i'm new in this group and i need your help experts :)

You are welcome :-)!

> sometimes some files are used by the system and is impossible to delete
> them, how
> can i queue a file to delete it at next system startup before it is in
> use?

How To Move Files That Are Currently in Use
<URL:http://support.microsoft.com/?scid=kb;EN-US;140570>

\\\
Private Declare Auto Function MoveFileEx Lib "kernel32.dll" ( _
    ByVal lpExistingFileName As String, _
    ByVal lpNewFileName As String, _
    ByVal dwFlags As Int32 _
) As Boolean

Private Const MOVEFILE_DELAY_UNTIL_REBOOT As Int32 = &H4
....
Dim Success As Boolean = _
    MoveFileEx( _
        <file name>, _
        vbNullString, _
        MOVEFILE_DELAY_UNTIL_REBOOT _
    )
///

--
M S   Herfried K. Wagner
M V P  <URL:http://dotnet.mvps.org/>
V B   <URL:http://classicvb.org/petition/>
Author
2 Jul 2006 4:31 PM
paraidy
Thx man :) now i try it, can you tell me how it work? it make the file
in queue in a specific location in the registry or what procedure use
the system to queue the files and delete them at startup? thx again :)

Herfried K. Wagner [MVP] ha scritto:

Show quoteHide quote
> "paraidy" <samore***@tiscali.it> schrieb:
> > Hi, i'm new in this group and i need your help experts :)
>
> You are welcome :-)!
>
> > sometimes some files are used by the system and is impossible to delete
> > them, how
> > can i queue a file to delete it at next system startup before it is in
> > use?
>
> How To Move Files That Are Currently in Use
> <URL:http://support.microsoft.com/?scid=kb;EN-US;140570>
>
> \\\
> Private Declare Auto Function MoveFileEx Lib "kernel32.dll" ( _
>     ByVal lpExistingFileName As String, _
>     ByVal lpNewFileName As String, _
>     ByVal dwFlags As Int32 _
> ) As Boolean
>
> Private Const MOVEFILE_DELAY_UNTIL_REBOOT As Int32 = &H4
> ...
> Dim Success As Boolean = _
>     MoveFileEx( _
>         <file name>, _
>         vbNullString, _
>         MOVEFILE_DELAY_UNTIL_REBOOT _
>     )
> ///
>
> --
>  M S   Herfried K. Wagner
> M V P  <URL:http://dotnet.mvps.org/>
>  V B   <URL:http://classicvb.org/petition/>
Author
2 Jul 2006 4:38 PM
Herfried K. Wagner [MVP]
"paraidy" <samore***@tiscali.it> schrieb:
> now i try it, can you tell me how it work? it make the file
> in queue in a specific location in the registry or what procedure use
> the system to queue the files and delete them at startup? thx again :)

Check out the "Remarks" section of 'MoveFileEx'' documentation:

File Systems -- 'MoveFileEx'
<URL:http://msdn.microsoft.com/library/en-us/fileio/fs/movefileex.asp>

--
M S   Herfried K. Wagner
M V P  <URL:http://dotnet.mvps.org/>
V B   <URL:http://classicvb.org/petition/>
Author
2 Jul 2006 4:48 PM
paraidy
Ok, Thx again, it worked, you helped me a lot :)

Herfried K. Wagner [MVP] ha scritto:

Show quoteHide quote
> "paraidy" <samore***@tiscali.it> schrieb:
> > now i try it, can you tell me how it work? it make the file
> > in queue in a specific location in the registry or what procedure use
> > the system to queue the files and delete them at startup? thx again :)
>
> Check out the "Remarks" section of 'MoveFileEx'' documentation:
>
> File Systems -- 'MoveFileEx'
> <URL:http://msdn.microsoft.com/library/en-us/fileio/fs/movefileex.asp>
>
> --
>  M S   Herfried K. Wagner
> M V P  <URL:http://dotnet.mvps.org/>
>  V B   <URL:http://classicvb.org/petition/>
Author
3 Jul 2006 1:15 AM
Crash_beta
in your Autoexec.BAT file put these lines
  Cd\
cd \Filepath
  attrib -r *.*
del *.*
  echo Chr$(13)


paraidy wrote:
Show quoteHide quote
> Hi, i'm new in this group and i need your help experts :) sometimes
> some files are used by the system and is impossible to delete them, how
> can i queue a file to delete it at next system startup before it is in
> use? thx all.
Author
3 Jul 2006 12:08 PM
C-Services Holland b.v.
Crash_beta wrote:
> in your Autoexec.BAT file put these lines
>   Cd\
> cd \Filepath
>   attrib -r *.*
>  del *.*
>   echo Chr$(13)
>
>

That'll work... if you're running win9x/WinME, but not Win2K and above.



--
Rinze van Huizen
C-Services Holland b.v