SunQuest
           Windows Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsOperating SystemsWindows Help

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
Get inside! Sample the range of functionality easily built with JMSL Library for Time Series Data Analysis, Heat Maps, Portfolio Optimization, Monte Carlo Simulation, Stock Price Charting and more. Download Now!
  #1  
Old October 3rd, 2002, 12:44 PM
SPQR SPQR is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Sep 2002
Posts: 9 SPQR User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Deleting Running Programs

In Windows 98, to delete a running program, a value can be put in the registry, HKLM\Software\Microsoft\Windows\Explorer\CurrentVersion\Runonce. This is a dos command line function. In the run directory it is command.com /c del "C:\[path][filename]". This works, and when the computer is rebooted, all files that are in the runonce registry key are deleted. This doesn't work in windows NT/2000/XP. The command line it the same, but it won't delete the files in the runonce registry key. I tried the same command line without the /c and that doesn't work. The del in the dos window has a different format. The one in 98 is del [drive][path][filename]. The one in XP is del [...][..[attributes]] names, and names it the filename. Is there a way to delete files in the dos window? The program is an installiation program, the program itself has to be removed the next time the computer is started.

Craig

Reply With Quote
  #2  
Old October 5th, 2002, 07:05 AM
M.Hirsch M.Hirsch is offline
Contributing User
Dev Shed God 1st Plane (5500 - 5999 posts)
 
Join Date: Oct 2000
Location: Back in the real world.
Posts: 5,969 M.Hirsch User rank is First Lieutenant (10000 - 20000 Reputation Level)M.Hirsch User rank is First Lieutenant (10000 - 20000 Reputation Level)M.Hirsch User rank is First Lieutenant (10000 - 20000 Reputation Level)M.Hirsch User rank is First Lieutenant (10000 - 20000 Reputation Level)M.Hirsch User rank is First Lieutenant (10000 - 20000 Reputation Level)M.Hirsch User rank is First Lieutenant (10000 - 20000 Reputation Level)M.Hirsch User rank is First Lieutenant (10000 - 20000 Reputation Level)M.Hirsch User rank is First Lieutenant (10000 - 20000 Reputation Level) 
Time spent in forums: 1 Month 1 Day 22 h 39 m 55 sec
Reputation Power: 184
the format does not matter (here)

- does your "del" command work when you type it in the dos-window?

- did you supply the full path to command.com (i.e. "C:\WINDOWS\SYSTEM32\COMMAND.COM")

- did you try putting the whole entry into quotes?

for win2000 and XP there is a better way:
make your installer remove itself using MoveFileEx(), it will fail (since it is running). but it will be deleted on the next reboot. nice feature, eh?
__________________
--
Manuel Hirsch - Linux, FreeBSD, programming, administration articles, tutorials and more.

Reply With Quote
  #3  
Old October 7th, 2002, 07:18 AM
SPQR SPQR is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Sep 2002
Posts: 9 SPQR User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
I typed the "del" command in a dos window and it worked. I typed hte full path to command.com" and there was no difference. The command.com works, there is an error in the dos window. The dos window displays:

specified COMMAND search directory bad
parameter format not correct
too many parameters

with command.com del "[drive][path][filename]" or "c:\windows\system32\command.com" del "[drive][path[filename]". I tried putting the whole thing in quotes and that didn't work either. The command is different than windows 95/98/ME, is it possible to use command line functions in the start menu\run program.

Craig

Reply With Quote
  #4  
Old October 7th, 2002, 01:19 PM
M.Hirsch M.Hirsch is offline
Contributing User
Dev Shed God 1st Plane (5500 - 5999 posts)
 
Join Date: Oct 2000
Location: Back in the real world.
Posts: 5,969 M.Hirsch User rank is First Lieutenant (10000 - 20000 Reputation Level)M.Hirsch User rank is First Lieutenant (10000 - 20000 Reputation Level)M.Hirsch User rank is First Lieutenant (10000 - 20000 Reputation Level)M.Hirsch User rank is First Lieutenant (10000 - 20000 Reputation Level)M.Hirsch User rank is First Lieutenant (10000 - 20000 Reputation Level)M.Hirsch User rank is First Lieutenant (10000 - 20000 Reputation Level)M.Hirsch User rank is First Lieutenant (10000 - 20000 Reputation Level)M.Hirsch User rank is First Lieutenant (10000 - 20000 Reputation Level) 
Time spent in forums: 1 Month 1 Day 22 h 39 m 55 sec
Reputation Power: 184
So, go for the MoveFileEx() approach (it is a WinApi function)

Reply With Quote
  #5  
Old October 11th, 2002, 06:34 AM
SPQR SPQR is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Sep 2002
Posts: 9 SPQR User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Will this work for 95/95/ME, or only 2000 and XP? It would make everything easier if it works for all windows versions.

Craig

Reply With Quote
  #6  
Old October 11th, 2002, 11:03 AM
SPQR SPQR is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Sep 2002
Posts: 9 SPQR User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
I tried the function, MoveFileEx(oldfilename, newfilename, NULL), on XP, but it didn't delete the files when I restarted. Shoud there be any flags set? Should this be MoveFile()?

Craig

Reply With Quote
  #7  
Old October 11th, 2002, 11:46 AM
M.Hirsch M.Hirsch is offline
Contributing User
Dev Shed God 1st Plane (5500 - 5999 posts)
 
Join Date: Oct 2000
Location: Back in the real world.
Posts: 5,969 M.Hirsch User rank is First Lieutenant (10000 - 20000 Reputation Level)M.Hirsch User rank is First Lieutenant (10000 - 20000 Reputation Level)M.Hirsch User rank is First Lieutenant (10000 - 20000 Reputation Level)M.Hirsch User rank is First Lieutenant (10000 - 20000 Reputation Level)M.Hirsch User rank is First Lieutenant (10000 - 20000 Reputation Level)M.Hirsch User rank is First Lieutenant (10000 - 20000 Reputation Level)M.Hirsch User rank is First Lieutenant (10000 - 20000 Reputation Level)M.Hirsch User rank is First Lieutenant (10000 - 20000 Reputation Level) 
Time spent in forums: 1 Month 1 Day 22 h 39 m 55 sec
Reputation Power: 184
Set lpNewFileName to NULL and dwFlags to MOVEFILE_DELAY_UNTIL_REBOOT

(found here: http://msdn.microsoft.com/library/d.../movefileex.asp )

it will only work for 2k and XP, for W9X you need to use your batch-file.

a lot would be easier if the two APIs weren´t that different

Reply With Quote
  #8  
Old October 11th, 2002, 01:51 PM
SPQR SPQR is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Sep 2002
Posts: 9 SPQR User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
There is a command in c++ that is supposed to delete files, and should delete files that are in use. The command is remove(). It deletes files, but it doesn't delete the file that the command is in, something that it is supposed to do. Is the information wrong about this command? The MoveFileEx() worked, but I want to see if there is a way that will work on all versions of windows.

Craig

Reply With Quote
  #9  
Old October 11th, 2002, 03:12 PM
M.Hirsch M.Hirsch is offline
Contributing User
Dev Shed God 1st Plane (5500 - 5999 posts)
 
Join Date: Oct 2000
Location: Back in the real world.
Posts: 5,969 M.Hirsch User rank is First Lieutenant (10000 - 20000 Reputation Level)M.Hirsch User rank is First Lieutenant (10000 - 20000 Reputation Level)M.Hirsch User rank is First Lieutenant (10000 - 20000 Reputation Level)M.Hirsch User rank is First Lieutenant (10000 - 20000 Reputation Level)M.Hirsch User rank is First Lieutenant (10000 - 20000 Reputation Level)M.Hirsch User rank is First Lieutenant (10000 - 20000 Reputation Level)M.Hirsch User rank is First Lieutenant (10000 - 20000 Reputation Level)M.Hirsch User rank is First Lieutenant (10000 - 20000 Reputation Level) 
Time spent in forums: 1 Month 1 Day 22 h 39 m 55 sec
Reputation Power: 184
dunno.
from my experience there is few (advanced) code that works for both... there´s a reason why MS is getting rid of W9X (no support anymore since 0106 afaik)

since you are a programmer too, some examples that might make you think:

- no PlugBlt() on W9X
- no SetWindowModeEx(WS_TRANSPARENT) on W9X
- coordinate space transformations: only very limited support on W9X (eg. no rotation of bitmaps by OS; w2K CAN DO...)
- limitation of bitmap sizes (16MB on W9X is 2666px x 2666px x 24bits)
- different behaviour on BeginPaint() and EndPaint()
...and so on.
i wish there never was a W9X. but on my current project i have to double about 20% of my functions to make my soft work on all of them...

anyone willing to share his experience?

Reply With Quote
Reply

Viewing: Dev Shed ForumsOperating SystemsWindows Help > Deleting Running Programs


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 2 hosted by Hostway