KILL - QB64 Wiki

KILL

From QB64 Wiki

Jump to: navigation, search

The KILL statement deletes a file on a relative path 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 but be careful!
* denotes one or more wildcard letters of a name or extension
? denotes one wildcard letter of a name or extension
  • Path can be relative to program's current location or use an absolute path 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.
  • 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 only!
  • Warning! Files deleted in DOS or QB64 will NOT go to the Recycle Bin and they CANNOT be restored!


Example:

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


See also:



Navigation:
Go to Keyword Reference - Alphabetical
Go to Keyword Reference - By usage
Go to Main WIKI Page
Views
Personal tools