Jump to content

Batch File and Wildcards...headache


Guest

Recommended Posts

do you just need the username in there? Then use the environment variable %username%

C:\Users\%username%\AppData\Local\Microsoft\Windows Virtual PC\Virtual Machines

C:\Users\%username%\Virtual Machines

"Cheap, good or fast. You can only pick two out of three."

"Have money? Love story! No money? I'm sorry."

Link to comment
Share on other sites

i need to delete both folders and their contents for every user on each computer. users will be different for each computer

ill try both ideas out when i get to work, ill let you guys know how it goes

Link to comment
Share on other sites

@echo off

for /d %%d in ("%userprofile%\..\*.*") do rd "%%d\AppData\Local\Microsoft\Windows Virtual PC\Virtual Machines\" /s /q

@echo off

for /d %%d in ("%userprofile%\..\*.*") do rd "%%d\virtual machines\" /s /q

and yes i tried \virtual machines\*.*

but it doesnt work :/ this is the best i could come up with.. ive been looking how to clear out the files and not the folder for two hours.. hope i helped

also please be aware that this is a HOT batch file.. meaning that it will destroy all data on every single user profile (except hidden ones) in the specified folders.

this is a working batch file for your needs, i just wish it didnt delete the final "virtual machines" folder and instead deleted all the files inside.

to get this to work (in case you dont know how) make a new text document and copy and paste the above into it, save it and fix the extension to .bat.

or if you know a faster way to make a .bat file, open the .bat file and edit it and paste the above into it.

this batch file has no pause command so all you will see is a flash on the screen then its done

it worked perfect man! i needed the folder deleted as well so it all worked out great. boss man is very happy :D

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Who's Online   0 Members, 0 Anonymous, 1282 Guests (See full list)

    • There are no registered users currently online
×
×
  • Create New...