Hello I'm trying to write a batch file to clean up my pc. But I'm having a bit of trouble. I try to delete a hidden file and I don't know how to use the
attributes to do so.

Just for an example I try

del /s /q /f /C:\Users\Phantom\AppData\Local\Microsoft\Windows\Temporary Internet Files\*

(without word wrap) And I get "system cannot find file"

Any help would be appreciated! Thx in advance

You are getting this error as dos cannot understand the space in the string and it truncates the rest of the file path.

Try this command:

del /s /q /f /"C:\Users\Phantom\AppData\Local\Microsoft\Windows\Temporary Internet Files\*"

Also if the aobe doesnot work then try create a test directory with a oneword name for the directory and perform the same delete action.

Let me know.

The quotation marks worked great! Thanks a lot.

I can't believe that I didn't think of it earlier. And I've tried everything but, for a week and a half ,lol.

Thanks so much for the quick response!

I'm very glad to have stumbled on a forum with intelligent people.

it happens;) i leanred from my mistakes, so i like to share whatever i have learnt. visit www.coderewind.com thats the site i started.

Actually I'm still having problems
Here is my code:

::Agita RULES!
del /s /q /f C:\Windows\Prefetch\*
del /s /q /f C:\Windows\Temp\*
del /s /q /f C:\Users\Phantom\AppData\Local\Temp\*
del /s /q /f C:\Users\Phantom\AppData\Roaming\Microsoft\Windows\Cookies\*
del /s /q /f "C:\Users\Phantom\AppData\Roaming\Microsoft\Windows\Recent\*"
del /s /q /f C:\Users\Phantom\AppData\Local\Microsoft\Windows\History\*
del /s /q /f "C:\Users\Phantom\AppData\Local\Microsoft\Windows\Temporary Internet Files\*"
pause

It still says it cannot find the cookies folder or the history folder. (with or without the quotations)
The rest work find , Any ideas?

Also is there anything that I can add to that will make it completely silent , to where you don't see the prompt

Can you try this bat file before Windows is loaded, i.e.
put in autoexec.bat "call YOUR.bat"

Figured out the attribute thing just add a "+" or a "-" to whatever random type of file that you want to edit

del /s /q /f /A +H "C:\Users\Phantom\AppData\Local\Microsoft\Windows\History\*"

Try this... It took me three days, but I finally got it.

Open Notepad
Paste the code below

FOR /D %%I in ("%appdata%\*") DO delete "%%C:\Windows\Tempor~1*.*" /s /q

FOR /D %%I in ("%appdata%\*") DO delete "%%C:\Windows\Tempor~1*.*" /s /q

Save file as "VistaDelete.bat"

Enjoy!!!

Hello I'm trying to write a batch file to clean up my pc. But I'm having a bit of trouble. I try to delete a hidden file and I don't know how to use the
attributes to do so.

Just for an example I try

del /s /q /f /C:\Users\Phantom\AppData\Local\Microsoft\Windows\Temporary Internet Files\*

(without word wrap) And I get "system cannot find file"

Any help would be appreciated! Thx in advance

you could try to go into the directories and look to see if it a directory or a file and if it is inside a directory go into the very last one AND THEN type del and the filename exactly word for word and then press enter that will most likely delete the file

I want to write a batchfile that will execute from my desktop and copy all .mdb files from N:\Program Files (x86)\InterActive DMS\Morgan's Car Sales and send to I:\MDB Backup. I have tried xcopy to do this but I can't get it to operate. I can go to cmd and go to the directory where the files are and xcopy them to I:\ and that is the best I can do. I am using 'Windows 7 (New to me). I have tried writing this batch file in Notebook but to no avail. Any help will be appreciated

@Agita: google cleanup.exe

It has command line options for silent running. It sounds as if you may be in a network (with roaming profiles?) if so you can get psexec from here: http://technet.microsoft.com/en-us/sysinternals/bb896649.aspx and use that to execute cleanup.exe remotely and silently. :-)

If I read your post correctly, you are using 64bit, referring to 'N:\Program Files..." possibly running a 'thin client' or 'terminal service'. Try the following command and run it as Administrator; robocopy "N:\Program Files (x86)\InterActive DMS\Morgan's Car Sales" "I:\MDB Backup" *.mdb /E /w:1 /r:1 /Log+:"I:\MDB Backup\Backup-log.txt" - ALL on one line.

Hi Gavin1069,
Let me explain what I have here. It is a simple in house 4 station network. I use my computer as the server. The programs that are shared with the other sorkstations are all on drive N: Drive N: is merely a partition of my C: drive. I have 21 mdb files that I want to backup every day from "N:\Program Files (x86)\InterActive DMS\Morgans Car Sales" to "I:\MDB Backup" . I do have Windows 7 64 bit on my computer and windows XP on the other 3. I would like a Bat file on my desktop to make this all happen. I could use switches that vewrify files and add only files that change.
I tried the one you sent and it did not work . I put it in Notepad and named it mdb.bat on my desktop. I also tried running it from cmd prompt to no avail. Maybe knowing what I am working with here will help.
Thanks for your efforts, I really appreciate it.

Hi D4Stone, thanks for the update, hmm.. The pot begins to boil. Please run the robocopy from the cmd line and paste the error message you get, I can then see what the error is and give you a solution. First of all before you do this, go to the cmd prompt (as administrator) and run 'robocopy /?'. This should give you robocopy help and verify that robocopy is on your system. Its free and built into Vista and Win7. Remember, if we see the error we can see what the problem is and go from there.

Whew!, I'm getting excited. I did what you asked me to do and got some results. I made screen copies of the results but I don't know how to attach them to this message. I may have figured it out. et me know if you get 3 attachments.

GOOD NEWS ! IT WORKED i TOOK ANOTHER SCREEN SHOT TO SHOW YOU, THE LAST ONE WORKED PERFECTLY. NOW can I make this a batch file called mdb.bat and place it on my desktop? or do I have to go to cmd to execute it?

I think we can close this thread. I made a Robocopy.exe file on my desktop and inserted the string you sent to me and walla! It worked like a charm. I have never heard of robocopy so I am going to have to do a little research on this program to learn more about using it. Thank you so much for the help gavin1069. I am certain there is a way to give you points or something on this site so I will look around and see if I can do that. Have a nice weekend.
D4Stone

My batch file will run and execute when clicked-on. It will not run when called via path from another program. Any fixes?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.