trying to make a batch file

Discussion in 'Software' started by William, Nov 30, 2003.

  1. William

    William Private E-2

    Hey not sure if i'm on the right board, but I'm trying to create a batch file that will delete a file when i boot my pc. I have no programing skills at all, but got some information on batch files, and commands and some technical notes on batch files. I am running win xp and have created a batch file that will delete a worthless gif image when i click on the batch file. Then I found my autoexec.bat file and edited it to call my file. I can click on the autoexec.bat file and it deletes the file, but won't delete it when i restart the pc. I was under the impression that the pc read the autoexec.bat file when booting. My batch file is named test.bat. Here's the way i edited my autoexec.bat file. @ECHO OFF
    set EXPAND=YES
    SET DIRCMD=/O:N
    set LglDrv=27 * 26 Z 25 Y 24 X 23 W 22 V 21 U 20 T 19 S 18 R 17 Q 16 P 15
    set LglDrv=%LglDrv% O 14 N 13 M 12 L 11 K 10 J 9 I 8 H 7 G 6 F 5 E 4 D 3 C
    cls
    call setramd.bat %LglDrv%
    set temp=c:\
    set tmp=c:\
    path=%RAMD%:\;a:\;%CDROM%:\
    copy command.com %RAMD%:\ > NUL
    set comspec=%RAMD%:\command.com
    copy extract.exe %RAMD%:\ > NUL
    copy readme.txt %RAMD%:\ > NUL
    call C:\windows\command\ebd\test.bat

    all above the call test.bat was already there, there is more below this but won't send it unless necessary.

    Below is the instructions that i was using to try to accomplish this goal.

    REFERENCE NUMBER: CH000322How to run a batch file each time the computer boots:



    Question:
    How to run a batch file each time the computer boots.
    Reasoning:
    It may be necessary to run a batch file to configure computer
    devices or delete / copy files each time the computer boots to help
    the computer run more efficient or allow a device to run.
    Solution:
    Place a line in your autoexec.bat that calls the batch file each
    time you want to boot the computer. For example:
    CALL C:\myfile.bat
    I've tried putting my batch file on the root dir, then it the folder with the autoexec.bat file. Any help would be greatly appreciated.
    Thanks William...:D
     
  2. mr_flea

    mr_flea First Sergeant

    put the batch file in the startup folder located in start - programs.
     
  3. William

    William Private E-2

    Mr Flea, Thanks for the help it worked like a top when I put in the startup folder. Thanks for the help,,, William:D
     
  4. mr_flea

    mr_flea First Sergeant

    You're welcome :)
     
  5. William

    William Private E-2

    Mr. Flea, I'm at it again. I made a batch file to del my cookies on start up. It works great thanks to your help. Now I'm trying to make another to del my temp internet files... In my windows explorer the I found the files In c:\documents and settings\william...\local settings\temp\temporary internet files. When I use that path in my batch file it says file not found... So I tried to find the files at the dos prompt.The files in the path beyond C:\DOCUMENTS AND SETTINGS\WILLIAM...\ do not show up at the dos prompt.. I did search for these files by booting my pc from a win98 boot disk and traced the path as follows c:\docume~1\willia~1.wei\locals~1\temp\tempor~1. But that directory show no files... Can you tell me what i'm doing wrong??? Or how to find the files in dos? Any help would be greatly appreciated.. thanks William :confused:
     
  6. mr_flea

    mr_flea First Sergeant

    Try just deleting the whole cookies folder, instead of all it's contents. I'm sure IE will regenerate it. Also, for the first line in the script, put cd\.

    But before you delete the whole cookies folder, make sure you do not have any websites remembering any passwords for you, because those are usually stored in the cookies folder.
     
  7. mr_flea

    mr_flea First Sergeant

    I'm sure there are better ways of doing this, but I'm too tired to remember anything right now. I'll think about it later.
     
  8. William

    William Private E-2

    thanks for the response, but I guess I didn't make myself clear. I am trying to make a batch file to delete the temporary internet files, not the cookies folder. I made one to delete the cookies files. My delima is that the temp files seem to be hidden and protected, when i reset the folder attributes to archive, in the folder properties, they are changed right back to read only, the next time i open it. I tried your suggestion of trying to delete the temporary internet file folder... It is used by windows and I get an error message that windows needs this file to operate correctly, when i try to delete it. But I can right click on the files and delete them. I have also tied to change the attributes in dos after booting from boot disk. There seems to be something written into windows that rewrites the attributes... I guess I could go though the internet options and delete them,, but i can't seem to remember to do that ... seemed that it would be effortless if i could make a batch file that would do it automatically when i start it up. Once I started trying to make it, It bacame more of a challenge to try to find a way to get it to work... I forgot to tell you I am running win xp. My command line in my batch file reads as follows (del c:\docume~1\willia~1.wei\locals~1\temp\tempor~1\*.*). if there is any other information that would help please let me know. Thanks again for your help. William
     
  9. mr_flea

    mr_flea First Sergeant

    Oh, ok, to remove read-only attributes, insert these lines in the code.

    attrib (file name here) -r

    remove the parenthesis when you put the file name in.

    also, if you would also like to remove hidden attributes, insert a space and -h after the -r.
     
  10. William

    William Private E-2

    Mr. Flea, thanks for your help and patients... I add the attrib command to the batch file , but it didn't help,, it still won't delete any of the temporary internet files. I think I am very close on the batch file... I picked a file from the temp folder,,, (the folder just before the temporary internet file folder) and made my command line read as follows...(del c:\docume~1\willia~1.wei\locals~1\temp\EETERN.BMP
    PAUSE) and it deleted the file... That tells me that there could be only 2 problems. 1 is that the tempor~1 is not the correct directory. Or the temporary internet folder is protected... But I can delete any file in it i want to so i don't think that's it...I have done searches to find the dos name of the temporary internet file folder. but nothing come up. I had to do the same type of search to find the folder name of the local settings folder, because using the tree command or just working my way to the end of the tree using the dir command and going to the next directory with the cd command didn't work. I can't find the tempory internet file folder. I can't help but think all i need it the dos name to the temporary internet folder. the search command i used at the dos prompt was .... C:\dir \*.* /A : D /S | FINDSTR "TEMPO.*" I found several temp folders but none of them in the path of above. I also tried the search with tem, and temp which yeilded many more results, but none correct. I tried to put the attrib -h -r -s on the first line of my batch file then del c:\docume~1\willia~1.wei\locals~1\temp\tempor~1 ... which didn't work either. I can see if i can find a way to put a screen shot of my explorer in here if that will help.
     
  11. mr_flea

    mr_flea First Sergeant

    Ok, the first thing I am going to recommend that you do is use the cd command to navigate to the directory. Then you can type del and the filename, instead of the whole directory and file name. Try it out in command prompt.

    Make sure that the directories you are going through are not read only by typing attrib -r for all of them.
     
  12. mr_flea

    mr_flea First Sergeant

    Also, if you just want to make sure that the temporary files do not take up much space, you can go into internet options, click settings, and move the disk space slider down to something low like 250, 100 or even 50 mb. That would keep all of the frequently visited content intact while deleting the stuff from places you don't visit much. You probably want to change that setting anyway, because I know that at least on my system, it's default is 1788 MB, and that is way too much of my hard drive to give up for temporary internet files.
     
  13. William

    William Private E-2

    I went through the directories one at atime removeing the attributes -r -h -s, on each one just as you suggested to be sure none of them could be causing a hold up. when i got to c:\docume~1\willia~1.wei\locals~1\temp\tempor~1 I typed (del biggrin.gif) a file I know is in the temporary internet file folder... got the error message file not found. I'm beginning to think there is a flukey problem with my machine... or is it that no one running win xp with fat 32 file system delete any of the temporary internet files from the dos prompt? I'm not going to give up yet, but must need to take different approach. I do have my space for storage turned down to 1 MB so it's not the space i'm worrying about. Just out of curiosity have you tried to delete one of your temporary internet files from the dos prompt? If you can't I'll know that there is nothing wrong with my machine. But if you don'twant to try it I wouldn't blame you... again thanks for all your help and suggestions..
     
  14. mr_flea

    mr_flea First Sergeant

    I'll go try to delete through command prompt right now. I'm also running XP (i'm running pro edition), but have a NFTS drive.

    btw, if you are using command instead of cmd, use cmd instead because command has really low functionality in XP.
     
  15. William

    William Private E-2


    I tried it at the cmd prompt too...It didn't make any difference...I had my son try to delete one of these files too, through the dos prompt. He couldn't delete them either. I am using xp home upgrade... that may have something to do with it... Thanks for the reply.
     
  16. William

    William Private E-2

    I guess i've hit a stump on this problem.... I think access must be denied to the temporary internet file folder, through the dos cmd or the dos command prompt. I even tried to remove the hidden, read only and system file attributes to the c:\ that didn't make any difference either. If you may know of anyone that can help me get around this problem please let me know... THANKS AGAIN FOR ALL YOUR HELP... William :D
     
  17. William

    William Private E-2

    I finally got my batch file to work... I guess you couldn't delete or find any of the files in the temporary internet file folder either..Or maybe just to busy to reply, at any rate i just wanted to let you know i found the solution. William :D
     
  18. mr_flea

    mr_flea First Sergeant

    That's good, I was stumped.
     
  19. Wyatt_Earp

    Wyatt_Earp MajorGeek

    In case anyone else was curious, I did a little searching around through the cmd prompt. Windows stores temporary internet files in subdirectories inside the "Temporary Internet Files" folder. On mine it is "Temporary Internet Files\Content.IE5\". However, in Windows Explorer, it shows them all to be in the "Temporary Internet Files" folder. If you delete all the subdirectories below this 'Content.IE5' folder, it will remove your temporary internet files. Now, I don't know if you should delete the folders themselves, or just the files in those temporary folders. I don't think it makes a difference though, IE will probably just recreate them.
     
  20. NeoNemesis

    NeoNemesis Moutharrhea

    Hello there. I know that you have found a solution to your first problem of making a file run at startup but I just want to let you know that in Windows XP (any edition) autoexec.bat is not loaded at startup. Instead autoexec.nt is.
     

MajorGeeks.Com Menu

Downloads All In One Tweaks \ Android \ Anti-Malware \ Anti-Virus \ Appearance \ Backup \ Browsers \ CD\DVD\Blu-Ray \ Covert Ops \ Drive Utilities \ Drivers \ Graphics \ Internet Tools \ Multimedia \ Networking \ Office Tools \ PC Games \ System Tools \ Mac/Apple/Ipad Downloads

Other News: Top Downloads \ News (Tech) \ Off Base (Other Websites News) \ Way Off Base (Offbeat Stories and Pics)

Social: Facebook \ YouTube \ Twitter \ Tumblr \ Pintrest \ RSS Feeds