need help making a batch file work
|
Original Message
|
Name: aztarginian
Date: June 17, 2006 at 09:33:46 Pacific
Subject: need help making a batch file work OS: XP home editionCPU/Ram: 2.79Ghz/512MB ramModel/Manufacturer: dell dimension 2350 |
Comment: 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 Application and 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
Report Offensive Message For Removal
|
|
Response Number 1
|
Name: tanveer_don
Date: June 17, 2006 at 21:13:25 Pacific
Subject: need help making a batch file work |
Reply: (edit)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 error use this del C:\Documents and Settings\Owner.BUCKSHOT\Desktop\test223.txt in place of del test223.txt
Report Offensive Follow Up For Removal
|
|
Response Number 2
|
Name: Mechanix2Go
Date: June 18, 2006 at 02:49:01 Pacific
Subject: need help making a batch file work |
Reply: (edit)"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
Report Offensive Follow Up For Removal
|
|
Response Number 3
|
Name: OnlyJC
Date: June 19, 2006 at 03:23:04 Pacific
Subject: need help making a batch file work |
Reply: (edit)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
Report Offensive Follow Up For Removal
|
Use following form to reply to current message: