JonesDK Posted September 28, 2005 Share Posted September 28, 2005 Hi... I'm curious to find out how to make Windows delete a specific file on shutdown... I'd rather do it on shutdown instead of startup. It's just a simple playlist but anyway... if you got a tip for me, please let me know.BTW, I'm using Windows XP Pro.Thanx Link to comment Share on other sites More sharing options...
Yzöwl Posted September 28, 2005 Share Posted September 28, 2005 ClickStart » Run » (type) gpedit.msc » OKThenComputer Configuration » Windows Settings » Scripts (Startup/Shutdown) » (Double Click) Shutdown » Addand browse to your script etc. Link to comment Share on other sites More sharing options...
JonesDK Posted September 28, 2005 Author Share Posted September 28, 2005 Ahh... nice Thank You! Link to comment Share on other sites More sharing options...
atomizer Posted September 28, 2005 Share Posted September 28, 2005 if you're trying to delete files that are in use by windows, you can use unlocker. works like a champ. Link to comment Share on other sites More sharing options...
JonesDK Posted October 2, 2005 Author Share Posted October 2, 2005 (edited) It's nothing like that but thanx anyway. It has to be done on every shutdown. Trying to figure out this scripting thing. So far I've figured I should use this:function DeleteFile(filespec){ var fso; fso = new ActiveXObject("Scripting.FileSystemObject"); fso.DeleteFile(filespec);}Just seems to be put into content in some way. Can't use the function as it is...The file is:C:\Program Files\foobar2000\playlists\000000000 - Default.fpl- or maybe the entire folder.Any help would be appreciated Edited October 2, 2005 by JonesDK Link to comment Share on other sites More sharing options...
Yzöwl Posted October 2, 2005 Share Posted October 2, 2005 In vbs you will probably want something like thisWScript.CreateObject("Scripting.FileSystemObject").DeleteFile("C:\Program Files\foobar2000\playlists\000000000 - Default.fpl") Link to comment Share on other sites More sharing options...
JonesDK Posted October 2, 2005 Author Share Posted October 2, 2005 Awesome - it works Thank You Yzöwl! Link to comment Share on other sites More sharing options...
gunsmokingman Posted October 2, 2005 Share Posted October 2, 2005 (edited) This is with a error control in it. It is always better to use a If Exists Statement,in a vbs script.If Exists statement to delete fileDim Fso : Set Fso = CreateObject("Scripting.FileSystemObject")If Fso.FileExists("C:\Program Files\foobar2000\playlists\000000000 - Default.fpl") ThenFso.DeleteFile("C:\Program Files\foobar2000\playlists\000000000 - Default.fpl") Else Msgbox "Cannot Find File", 0 + 32, "Error"End If If Not Statement to delete fileDim Fso : Set Fso = CreateObject("Scripting.FileSystemObject")If Not Fso.FileExists("C:\Program Files\foobar2000\playlists\000000000 - Default.fpl") ThenMsgbox "Cannot Find File", 0 + 32, "Error"Else Fso.DeleteFile("C:\Program Files\foobar2000\playlists\000000000 - Default.fpl") End If The If exixts Statement in One LineDim Fso : Set Fso = CreateObject("Scripting.FileSystemObject") : If Fso.FileExists("C:\Program Files\foobar2000\playlists\000000000 - Default.fpl") Then Fso.DeleteFile("C:\Program Files\foobar2000\playlists\000000000 - Default.fpl") Else Msgbox "Cannot Find File", 0 + 32, "Error" End If Edited October 2, 2005 by gunsmokingman Link to comment Share on other sites More sharing options...
JonesDK Posted October 3, 2005 Author Share Posted October 3, 2005 (edited) Cool... will try one of those. I was a little too quick with the first script. It DID give an error... just not when I tested it using cscript.exe, but on shutdown it did. Edited October 3, 2005 by JonesDK Link to comment Share on other sites More sharing options...
JonesDK Posted October 3, 2005 Author Share Posted October 3, 2005 I get the error "Cannot find script engine 'VBSCript' for 'C:\Script.vbs'"Any idea how to fix this?Thanx Link to comment Share on other sites More sharing options...
gunsmokingman Posted October 3, 2005 Share Posted October 3, 2005 right click the vbs file select open withnavigate to windows\system32\wscript.exeselect that.It sound like you have to re associate the wscript asthe defualt script engine. Link to comment Share on other sites More sharing options...
JonesDK Posted October 4, 2005 Author Share Posted October 4, 2005 (edited) Found another quite simple solution And by the way, it WAS already associated to wscript, so I don't know exactly what's wrong. Maybe I need a re-install of windows. Been a long time now.The simple solution was to just make a clean playlist and make it read-only. And it seems to work Thanx all for your suport anyway. Edited October 4, 2005 by JonesDK Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now