The Touch CMD command is a Windows command line utility that allows users to create, change, or delete files and directories. This command is useful for creating new files, modifying existing files, and deleting files and directories. The Touch command is also used to update the timestamp of a file or directory, which can be used to indicate when the file or directory was last modified. In this article, we will discuss the syntax, options, and user examples of the Touch CMD command.

Syntax of the Touch CMD Command

The syntax of the Touch CMD command is as follows:

touch [options] filename

Where filename is the name of the file or directory to be created, modified, or deleted.

Options of the Touch CMD Command

The Touch CMD command has the following options:

  • -a – This option is used to update the access timestamp of a file or directory.
  • -c – This option is used to not create a new file or directory if it does not exist.
  • -m – This option is used to update the modification timestamp of a file or directory.
  • -r – This option is used to use the timestamp of an existing file or directory as the timestamp for the new file or directory.

User Examples of the Touch CMD Command

Now that we have discussed the syntax and options of the Touch CMD command, let’s look at some user examples of how to use this command.

Example 1: Creating a New File

To create a new file with the Touch CMD command, use the following steps:

  1. Open the Command Prompt.
  2. Type the following command: touch filename, where filename is the name of the file to be created.
  3. Press Enter to execute the command.

The file will be created in the current directory.

Example 2: Updating the Timestamp of a File

To update the timestamp of a file with the Touch CMD command, use the following steps:

  1. Open the Command Prompt.
  2. Type the following command: touch -m filename, where filename is the name of the file whose timestamp is to be updated.
  3. Press Enter to execute the command.

The timestamp of the file will be updated to the current time.

Example 3: Deleting a File

To delete a file with the Touch CMD command, use the following steps:

  1. Open the Command Prompt.
  2. Type the following command: touch -c filename, where filename is the name of the file to be deleted.
  3. Press Enter to execute the command.

The file will be deleted from the current directory.

Conclusion

In conclusion, the Touch CMD command is a Windows command line utility that allows users to create, change, or delete files and directories. This command is useful for creating new files, modifying existing files, and deleting files and directories. The Touch command is also used to update the timestamp of a file or directory, which can be used to indicate when the file or directory was last modified. In this article, we discussed the syntax, options, and user examples of the Touch CMD command.

Leave a Reply