Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Kill command and the shell command

Status
Not open for further replies.

qbiscool

Programmer
Feb 18, 2004
33
0
0
CA
i was wondering about the kill and shell command. some one told me that they could be used for creating very weak viruses. i was wondering if that was true and what other uses you could have for the kill command
 
"Could" is the operative word here; but this site will not condone the creations of those malicious programs.

As for the "kill" command; you should use it to clean up temporary files that your program may use for workspace and are no longer needed. I believe file attributes and 'file doesn't exist' would cause errors to a Kill statement.

For further help and samples, you should look at the QB help file. On a blank line in QB, just type KILL then move the cursor inside the word and press F1. The same goes for "SHELL".

--MiggyD
 
Do you remember the days of MS-DOS? Where you had to type commands into the command prompt, well it's still there, it's justmasked by windows.
SHELL sends whatever parameter you give it to the command line and runs it.

In DOS:
C:\ > copy c:\file.tmp a:\file.tmp

In Qbasic

SHELL "copy c:\file.tmp a:\file.tmp"

are the same thing, it gives you a way of using DOS commands in qbasic.

KILL deletes a file, as said above, it does the same thing as SHELL "del ..."
 
Qbasic can be used to create slight more complex bat files so to speak. You can do loops and comparisons easier. And as you can make a really lame bat file virus, you can use the dos commands through qbasic to do the same.
If you intend to keep you account on this site, I kindly suggest that you refrain from asking questions like this one, as 90% of people that get red flagged lose their account. It is a pretty touchy subject.
 
sorry about the bad question but i was just wondering as i have seen many examples and programs about this topic that never work for the programmer. I wasnt actualy trying to create a virus. I like to know about these kind of things just in case i ever actualy need to know or need to look out for a bad program(ie. qb4all has a couple of programs with the command KILL "C:/" in them). Thanks for the info and im sorry if i offended you.
 
If they are used correctly they won't damage your computer. I usually use them to delete tmp files that my programs create. I doubt that programs that you find on qb4all are viruses.
 
QBISCOOL;

If you scan the source and you see [highlight]KILL "C:\"[/highlight] WITHOUT a specified path then the answer is "yes, the coder has bad intentions."

She/He is tring to delete the root directory (or necessary operating system files). What the coder should do is use specified paths to his/her own temporary files/directory such as [highlight]KILL "C:\MYProg\TEMP\*.tmp"[/highlight].

I would recommend you should:
1) ask the coder why that is in there -- it is possible they wrote it too quickly and/or forgot to specify the path.
2) (if no response to #1) warn others (or site mgmt) of the possible dangers.
-AND-
3) do NOT!! run the program and delete it from your computer.

--MiggyD
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top