1. Flag a file to be deleted
- Posted by Eucoder <eucoder at hotmail.com> Nov 13, 2004
- 461 views
Hi All, Does anyone know how to delete a locked file when Windows 2000/XP boots? I have seen programs flag files to be deleted next time Windows boots up, but I can’t seem to figure this out.
2. Re: Flag a file to be deleted
- Posted by "Juergen Luethje" <j.lue at gmx.de> Nov 13, 2004
- 466 views
Eucoder wrote: <snip> > Hi Chris, > Thanks for the response! > The problem with that is the file will be locked before my program runs. > There is a way to have Windows delete a file when booting up, but I am not > sure how to do it on a WinXP/2000 machine. On Win 95/98/ME you could use > WININIT.ini to do it. I use a DOS program for this purpose, that is started by AUTOEXEC.BAT. Works fine on Windows 98, but unfortunately I can't tell about Win 2000/XP. Regards, Juergen
3. Re: Flag a file to be deleted
- Posted by CoJaBo <cojabo at suscom.net> Nov 13, 2004
- 491 views
Juergen Luethje wrote: > > Eucoder wrote: > > <snip> > > > Hi Chris, > > Thanks for the response! > > The problem with that is the file will be locked before my program runs. > > There is a way to have Windows delete a file when booting up, but I am not > > sure how to do it on a WinXP/2000 machine. On Win 95/98/ME you could use > > WININIT.ini to do it. > > I use a DOS program for this purpose, that is started by AUTOEXEC.BAT. > Works fine on Windows 98, but unfortunately I can't tell about Win > 2000/XP. 2K/XP ignore autoecxec.bat (which I used). You can configure it to scan for SET commands, but that would be of no use... Now I just delete files like that manually, using either the Win XP repair CD or Knoppix if the drive isn't NTFS(Does the newer version support NTFS? Maby I should upgrade...). > > Regards, > Juergen > >
4. Re: Flag a file to be deleted
- Posted by akusaya at gmx.net Nov 13, 2004
- 455 views
=0D E> Does anyone know how to delete a locked file when Windows 2000/XP boots?= E> I have seen programs flag files to be deleted next time Windows boots up= , E> but I can=92t seem to figure this out. Moving Files in Windows NT Win32-based applications running on Windows NT should use MoveFileEx() with the MOVEFILE_DELAY_UNTIL_REBOOT flag to move, replace, or delete files and directories currently being used. The next time the system is rebooted, the Windows NT bootup program will move, replace, or delete the specified files and directories. To move or replace a file or directory that is in use, an application must specify both a source and destination path on the same volume (for example, drive C:). If the destination path is an existing file, it will be overwritten. If the destination path is an existing directory, it will not be overwritten and both the source and destination paths will remain unchanged. Here is an example call to move or replace a file or move a directory: // Move szSrcFile to szDstFile next time system is rebooted MoveFileEx(szSrcFile, szDstFile, MOVEFILE_DELAY_UNTIL_REBOOT); To delete a file or directory, the application must set the destination path to NULL. If the source path is a directory, it will be removed only if it is empty. Note that if you must use MoveFileEx() to remove files from a directory, you must reboot the computer before you can call MoveFileEx() to remove the directory. Here is an example of how to delete a file or empty a directory: // Delete szSrcFile next time system is rebooted MoveFileEx(szSrcFile, NULL, MOVEFILE_DELAY_UNTIL_REBOOT); >From http://support.microsoft.com/default.aspx/kb/140570/EN-US/
5. Re: Flag a file to be deleted
- Posted by Eucoder <eucoder at hotmail.com> Nov 13, 2004
- 508 views
> Moving Files in Windows NT > > Win32-based applications running on Windows NT should use MoveFileEx() > with the MOVEFILE_DELAY_UNTIL_REBOOT flag to move, replace, or delete > files and directories currently being used. The next time the system > is rebooted, the Windows NT bootup program will move, replace, or > delete the specified files and directories. > > To move or replace a file or directory that is in use, an application > must specify both a source and destination path on the same volume > (for example, drive C:). If the destination path is an existing file, > it will be overwritten. If the destination path is an existing > directory, it will not be overwritten and both the source and > destination paths will remain unchanged. Here is an example call to > move or replace a file or move a directory: > > // Move szSrcFile to szDstFile next time system is rebooted > MoveFileEx(szSrcFile, szDstFile, MOVEFILE_DELAY_UNTIL_REBOOT); > > To delete a file or directory, the application must set the > destination path to NULL. If the source path is a directory, it will > be removed only if it is empty. Note that if you must use MoveFileEx() > to remove files from a directory, you must reboot the computer before > you can call MoveFileEx() to remove the directory. Here is an example > of how to delete a file or empty a directory: > > // Delete szSrcFile next time system is rebooted > MoveFileEx(szSrcFile, NULL, MOVEFILE_DELAY_UNTIL_REBOOT); > > > >From <a > >href="http://support.microsoft.com/default.aspx/kb/140570/EN-US/">http://support.microsoft.com/default.aspx/kb/140570/EN-US/</a> > > Thanks! That seems like what I need