From QB64 Wiki
DOS is a command line driven disk operating system that does not use a graphical interface. QB64 can use SHELL to access DOS.
MSDOS is installed on Windows 3, 95, 98, and Virtual DOS Machine (NTVDM) on 32 bit NT systems only.
- DOS commands can refer to wildcard characters in file names, paths or extensions to work with multiple files.
- * denotes one or a group of wildcard letters of a file name, path or extension.
- ? denotes each wildcard letter of a file name, path or extension.
- SHELL _HIDE must be used in QB64 when sending DOS screen output to a file: CMD /C required!
- DOScommand > filename can be used to send screen output to a file. Previous file content is removed.
- DOScommand >> filename can be used to append screen output to a file. Content is added to previous.
- CMD /C may be required before some NTVDM commands for them to work properly!
- START can be used to /WAIT for a program to close or to /MIN or /MAX a program window.
- Windows, file names or paths with spaces require quotation marks using CHR$(34) on both sides of path or file name string:
- Note: For spaced file name and path entries, LINE INPUT allows the user to include those quotation marks also.
- Qbasic BAS files can be run like compiled programs without returning to the IDE when SYSTEM is used to end them!
- QB64 can use long path folder names and file names and SHELL command lines can be longer than 124 characters!
The DOS Copy command allows you to copy one file to another file name or folder path. NAME only renames a file in QBasic!
- COPY [/A | /B] source [/A | /B] [+ source [/A | /B] [+ ...]] [destination] [/A | /B]] [/V] [/Y | /-Y]
Option Description /A Indicates an ASCII text file. /B Indicates a binary file. + Combines contents of two or more files into one file destination. destination Specifies the directory or filename to use for the new file(s). /V Verifies that new files are copied correctly. /Y Suppresses prompt to confirm user overwrite of an existing file. /-Y Prompts to confirm a user overwrite of existing destination file.
Example: Copy two binary files to a destination binary file name: COPY /B file1 + /B file2 /B file3
Del or Delete can be used to completely remove files from the computer with or without a prompt. The QBasic equivalent is KILL.
- DEL [/P] [/F] [/S] [/Q] [/A[[:]attributes]] names
Option Sub Description /P Prompts for confirmation before deleting each file. /F Force deleting of read-only files. /S Delete specified files from all subdirectories. /Q Quiet mode, do not ask if ok to delete on global wildcard /A Selects files to delete based on the following attribute letters: A Files ready for archiving H Hidden files R Read-only files S System files - Prefix meaning not
The DOS equivalent of FILES in QBasic that has more file and directory sorting and attribute options. Screen information can be sent to a file using > filename to create a new file or >> filename to append information to an existing file after the DIR command.
* can designate one or more wildcard characters in the file name parameter when more than one file name may exist.
? can designate a single wildcard character in the file name parameter when more than one file may exist.
- DIR [drive:][path][filename] [/A[[:]attributes]] [/B] [/C] [/D] [/L] [/N] [/O[[:]sortorder]] [/P] [/Q] [/S] [/T[[:]timefield]] [/W] [/X] [/4]
Option Sub Description [drive:][path] Specifies drive, directory, or files to list. [filename] Full or partial file name may use * or ? wildcard characters /A Attributes as listed below: A Files ready for archiving D Directories H Hidden files R Read-only files S System files - attribute prefix means not /B Bare list of file names without header information or drive summary. /C Displays the thousand separator in file sizes(default). - Prefix before C to eliminate the thousands separator. /D Same format as wide(/W) but files are list sorted by column. /L Lists file names in lowercase. /N Long list format filenames listed short before the long name. /O List files in a sorted order: D Sorts by date/time (oldest first) E Sorts by extension alphabetically G Group directories first N Sorts by name alphabetically S Sorts by size with smallest first - Prefix to reverse sort order /P pauses each screen of information. /Q displays owner of the file. /S displays files in specified directory with all subdirectories. /T control what time field is displayed or used for sorting: A Last file access time C File creation time W Last time file was written to /W Wide list display format. /X Long list format filenames listed short before the long name. /4 Displays four-digit years - Prefix before format overrides default DIRCMD setting: /-D /-W /-X
- Note: To use the DIRCMD environment variable to permanently set the wide display format (that is, /w) as the default format, type the following command in your Autoexec.nt file: set dircmd=/w To clear all default settings, type: set dircmd=
- SHELL, _HIDE
- KILL, CHDIR
- MKDIR, RMDIR
- NAME, FILES
- _FILEEXISTS, _DIREXISTS
- Batch Files
- C Console Library
- MSDOS commands
- Linux Commands
- Mac OSX commands