473,406 Members | 2,281 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

how to delete a file when the windows start

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.

Jul 2 '06 #1
6 1110
"paraidy" <sa*******@tiscali.itschrieb:
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/>

Jul 2 '06 #2
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:
"paraidy" <sa*******@tiscali.itschrieb:
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/>
Jul 2 '06 #3
"paraidy" <sa*******@tiscali.itschrieb:
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/>
Jul 2 '06 #4
Ok, Thx again, it worked, you helped me a lot :)

Herfried K. Wagner [MVP] ha scritto:
"paraidy" <sa*******@tiscali.itschrieb:
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/>
Jul 2 '06 #5
in your Autoexec.BAT file put these lines
Cd\
cd \Filepath
attrib -r *.*
del *.*
echo Chr$(13)
paraidy wrote:
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.
Jul 3 '06 #6
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
Jul 3 '06 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

12
by: hokiegal99 | last post by:
The below code does what I need it to do, but I thought that using something like ext = os.path.splitext(fname) and then searching ext for '.mp3' would be a much more accurate approach to solving...
23
by: da Vinci | last post by:
Greetings, Onwards with the school studying. Working on a program and need to delete a file from a known location on the hard drive but cannot get anything I do to work. I have tried to use...
16
by: Philip Boonzaaier | last post by:
I want to be able to generate SQL statements that will go through a list of data, effectively row by row, enquire on the database if this exists in the selected table- If it exists, then the colums...
2
by: Terry K via AccessMonster.com | last post by:
I use netzero and they are always downloading ads on my computer. I've found where they are stored and the file names. I'd like to write a few lines that would delete these files when I start or...
12
by: Lucas Tam | last post by:
I have a very simple loop: If (Directory.Exists(tempDirectory)) Then Try Dim Files() As String = Directory.GetFiles(tempDirectory) 'Clear out directory For Each Filename As String In Files...
2
by: createdbyx | last post by:
I am trying to make a file sync utillity to sync files between my laptop and my desktop pc. On my desktop machine (xp pro sp2) I have shared my "Visual Studio Projects" folder using windows simple...
5
by: wo20051223 | last post by:
Deleting some files with C# fails with "Access to the path 'X' is denied". I have files copied from a CD that I burned (and not locked by a process) and a text file that I created in Windows...
6
by: sam_cit | last post by:
Hi Everyone, I'm using remove() function to delete a file, and i observed the following behavior, Concerned file : sample.txt Operation : i open the file in read mode and don't close the...
7
by: Ganesh | last post by:
Hi, I would like to know if there is any way I can forcefully delete a file locked by another process on Windows as well as on Linux. On windows DeleteFile returns me error code 32 (Process...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.