Hilight/select a file with a batch script



As an IT administrator, you may find yourself in a situation where you need to hilight or select a file with a batch script. This can be a useful tool for automating tasks or otherwise streamlining the workflow in the office.

The first step in dealing with this task is to make sure that the file you need to hilight or select is in the working directory of the computer. If it isn't, you will need to move it to the working directory first. This can be done using the \move\ command:

\move source_file destination_folder\

Once the file is in the working directory, you can use the \forfiles\ command to hilight or select it. The syntax for this command is:

\forfiles /p path /m mask /d [-]date [/c command] [/f]\

In this case, the \/p\ option is used to specify the path of the working directory, the \/m\ option is used to specify the file mask (i.e. the file name), and the \/d\ option is used to specify the date (either a positive or negative number).

The \/c\ option is used to specify the command that will be executed on the file, and the \/f\ option is used to specify the format of the output. For example, you could use the \/c\ option to execute a \ren\ command to rename the file, and the \/f\ option to specify that the output should be in the form of a text file.

Now, once you've specified the necessary options, you can execute the command. In this case, the command would look like this:

\forfiles /p c:\\working_directory /m file_name.txt /d +0 /c ren file_name.txt file_name_hilighted.txt /f\

This command will hilight or select the specified file in the working directory. Once the command is executed, the file will be renamed with the \_hilighted.txt\ suffix.

In addition to hilighting or selecting a file with a batch script, you can also use the \forfiles\ command to perform other tasks on the file. For example, you could use the \/c\ option to delete the file, or execute other commands on the file such as \copy\ or \move\.

Overall, the \forfiles\ command can be a powerful tool for automating tasks and streamlining the workflow in the office. With it, you can easily hilight or select a file with a batch script and perform other tasks on the file as necessary.

Inquire Now

Thank you! Your submission has been received!
Oops! Something went wrong while submitting the form.
Find your next full or part-time role here

ScaleDesk can either help you find your next full time gig or a part time side gig where you can create extra income!

Onboard with us once
Skip HR screening and go to the final interview with with only your resume and a video interview you never have to redo
Get paid electronically every month for the hours you work
We will be your reference even if you work for us once

IT Teams: Use ScaleDesk to augment your team

Schedule Demo