Deleting Java Cache
Hello All,
I'm looking for a script to delete Java cache files. I have to remote into user's pc to delete the cache once in a while and would be nice to delete it through script.
Thank you
0 Comments
[ + ] Show comments
Answers (2)
Answer Summary:
Please log in to answer
Posted by:
SMal.tmcc
9 years ago
you would need to run the script as logged-in user since that is in the profile area.
del %HOMEPATH%\appdata\LocalLow\Sun\Java\Deployment\cache\6.0\*.* /s /q
You can create a batch file and run it invisible this way:
http://www.itninja.com/blog/view/how-to-hide-running-a-batch-file-from-a-kscript-with-version-5-5
del %HOMEPATH%\appdata\LocalLow\Sun\Java\Deployment\cache\6.0\*.* /s /q
You can create a batch file and run it invisible this way:
http://www.itninja.com/blog/view/how-to-hide-running-a-batch-file-from-a-kscript-with-version-5-5
Comments:
-
I created the script
vbs.
CreateObject("Wscript.Shell").Run"Javacachedel",0,True
bat
del %HOMEPATH%\appdata\LocalLow\Sun\Java\Deployment\cache\6.0\*.*
kscript file: "c:\windows\system32\wscript.exe"
Parameters: javacachedelete.vbs.
I even run it on the test PC and the only thing works is the batch file. VBS does nothing. - Kdebiasse 9 years ago-
I fogot I added /s/q and still does not work through kace. - Kdebiasse 9 years ago
Posted by:
SMal.tmcc
9 years ago
ok your vbs code needs to be
now when you create your launch a program
Directory:
CreateObject("Wscript.Shell").Run "Javacachedel.bat",0,Truethe Javaschedel.bat needs to be
del %HOMEPATH%\appdata\LocalLow\Sun\Java\Deployment\cache\6.0\*.* /s /qcreate a script and add both those as dependencies.
now when you create your launch a program
Directory:
$(KACE_DEPENDENCY_DIR)File: (yes the double quotes are necessary for this to work)
"c:\windows\system32\wscript.exe"Parameters:
script.vbs
Comments:
-
make sure this is a online script and you select "windows run as" = logged-in user - SMal.tmcc 9 years ago
-
the reason I have my launch that way is the kbot file structure is generated by the id number of the script so that is a not a fixed constant. To get around that I use the variable $(KACE_DEPENDENCY_DIR) as the launch directory of the program, that way the kbox knows the id and can go there to start the call. I then call the program with quotes to trick the engine into calling an executable in another location, otherwise it will try to launch wscript from the $(KACE_DEPENDENCY_DIR) and fail. and since cmd interpreter is in the $(KACE_DEPENDENCY_DIR) when it starts the "wscript.exe script.vbs" it finds the parameter in that directory and runs the vbs file. - SMal.tmcc 9 years ago
-
Thank you so much it works. I guess I forgot the .bat in vbs and run as logon user. - Kdebiasse 9 years ago
-
thats why I like to post it in pictures or code, it helps you compare to find the difference, the scripts do not forgive code errors - SMal.tmcc 9 years ago
-
always remember any script that has a user level environment variable like %homepath%, %APPDATA%, %USERPROFILE%, etc has to be run as user, the system has no clue what those stand for. - SMal.tmcc 9 years ago