Tom's Guide | Tom's Hardware | Tom's Games
![]() |
![]() |
![]() |
Ok so heres the problem. I am trying to make a batch file that will autorun on a cd and delete a text file I have on my desktop. The autorun works and the batch file does so only if its run twice without the autorun, in other words when the autorun and batch files are burnt to a cd and run it doesn't work. Heres the autorun code
[autorun]
open=b1.bat
icon=myicon.ico
label=My Applicationand heres the batch file code
del test223.txt
I tried the Q/ syntax and the cd commands but it still doesn't work. If you could hlep that would be appreciated thanks.
the file i'm trying to delete is called test223.txt
oh and heres my text file path
C:\Documents and Settings\Owner.BUCKSHOT\Desktop\test223.txt

try to use absulute path of the file.
when u using del test223.txt in ur batch file its only try at the current location and it is ur cdrom .So it is only trying to delete test223.txt which is in ur cdrom and it will give erroruse this
del C:\Documents and Settings\Owner.BUCKSHOT\Desktop\test223.txtin place of del test223.txt

"I tried the Q/ syntax and the cd commands but it still doesn't work."
Sure. But what does it *DO* ?
tanveer_don,
If that's the problem, it will need:
del "C:\Documents and Settings\Owner.BUCKSHOT\Desktop\test223.txt"
=====================================
If at first you don't succeed, you're about average.M2

Would this help?
----
set tFile=%homedrive%%homepath%\desktop\test223.txt
IF EXIST %tFile% goto delMe
echo No File to Delete
goto end:delme
del "%tFile%" /q:end
exit
----Breakdown:
set tFile - Set up the filename to access (should be on one line)
IF EXISTS - Check if the file exists before deleting it
%homedrive% - Your main Home drive (C:)
%homepath% - Your current user directory (username logged on and path)
/q - Quiet mode (don't confirm)Using above option will mean you can use your CD on different users and it will delete
OnlyJC
www.purple-fire.com

![]() |
![]() |
![]() |

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.
| Ads by Google |