Difference between revisions of "KILL"

From QB64 Wiki
Jump to navigation Jump to search
imported>SMcNeill
(style guidelines)
imported>SMcNeill
m (-)
Line 13: Line 13:
 
* [[KILL]] cannot remove an [[OPEN]] file. The program must [[CLOSE]] it first.   
 
* [[KILL]] cannot remove an [[OPEN]] file. The program must [[CLOSE]] it first.   
 
* If the path or file does not exist, a "File not found" or "Path not found" [[ERROR Codes|error]] will result. See [[_FILEEXISTS]].
 
* If the path or file does not exist, a "File not found" or "Path not found" [[ERROR Codes|error]] will result. See [[_FILEEXISTS]].
* [[SHELL]] ''"DEL /Q " + fileName$'' does the same without a prompt or verification for wildcard deletions.
+
* {{InlineCode}}[[SHELL]] "DEL /Q " + fileName${{InlineCodeEnd}} does the same without a prompt or verification for wildcard deletions.
* [[SHELL]] ''"DEL /P " + fileName$'' will ask for user verification.  
+
* {{InlineCode}}[[SHELL]] "DEL /P " + fileName${{InlineCodeEnd}} will ask for user verification.  
 
* Cannot delete folders or directories. Use [[RMDIR]] to remove empty folders.
 
* Cannot delete folders or directories. Use [[RMDIR]] to remove empty folders.
 
* '''Warning: files deleted with [[[KILL]] will not go to the Recycle Bin and they cannot be restored.'''
 
* '''Warning: files deleted with [[[KILL]] will not go to the Recycle Bin and they cannot be restored.'''

Revision as of 20:10, 21 September 2017

The KILL statement deletes a file designated by a STRING value or variable.


Syntax

KILL fileSpec$


  • fileSpec$ is a literal or variable string path and filename. Wildcards * and ? can be used with caution.
* denotes one or more wildcard letters of a name or extension
? denotes one wildcard letter of a name or extension
  • fileSpec$ can include a path that can be either relative to the program's current location or absolute, from the root drive.
  • KILL cannot remove an OPEN file. The program must CLOSE it first.
  • If the path or file does not exist, a "File not found" or "Path not found" error will result. See _FILEEXISTS.
  • SHELL "DEL /Q " + fileName$ does the same without a prompt or verification for wildcard deletions.
  • SHELL "DEL /P " + fileName$ will ask for user verification.
  • Cannot delete folders or directories. Use RMDIR to remove empty folders.
  • Warning: files deleted with [[[KILL]] will not go to the Recycle Bin and they cannot be restored.


Examples

KILL "C:\Qbasic\data\2000data.dat"


See also



Navigation:
Keyword Reference - Alphabetical
Keyword Reference - By Usage
Main Wiki Page