Friday 9 November 2018

Wildcard commands

Wildcard commands are used when we are working with multiple files instant of a single file at a time. These commands uses '?' and '*' symbol.

The '?' wildcard character

Suppose we want to list out all the files and directories which have primary file name made of four characters and secondary name made of 3 characters. then here we use DIR command with following switches

C:\> DIR ????.???

Here a '?' symbol represent that ? can be a any character or it may be special symbols.

Suppose we want to list out all the files which primary field name made of  4 characters, the first character start with 'C' and secondary name is 'EXE'. Then we uses

C:\> DIR C???.EXE

The '*' wildcard character

If we want to list all the files with extension .EXE the the command we give is-

C:\> DIR *.EXE

If we want to display all files with first character 'D' and extension 'EXE' in floppy disk, then we give the command

C:\> DIR A: D*.EXE

Some Internal commands with wild card

COPY:-If we have to copy the songs from our CD drive to our Hard disk. Then we suppose E:\ is our CD drive and we have to store all the songs in C:\ SONGS directory.

C:\> COPY   E:\ *.MP3   C:\ SONGS

REN:- If we want to rename all the files which have extension of 'TXT' to extension 'MSG' then we give the command

C:\> REN  *.TXT   *.MSG

DEL:- If we want to erase those files which have the extension of 'TMP' from our disk then we uses the command

C:\> DEL  *.TMP
If we use /p switch the computer give ask every time before deleting the file. If we enter 'Y' the it will erase the file from disk either it will leave the file.

No comments:

Post a Comment