Home > front end >  Windows Batch File: How to dynamically pick up input filenames and also use as the output filename?
Windows Batch File: How to dynamically pick up input filenames and also use as the output filename?

Time:02-08

I am trying to create a batch file on Windows to run this psiblast application. An example of the command is as follows:

psiblast -db swissprot -query ./seq/C3W5S7.FASTA -out ./out/C3W5S7.FASTA

The input is the '-query' option and output is the '-out' option.

I have a folder 'seq' that contains all the input data files to query the application. The input files are all named with their unique IDs (e.g. in this case, C3W5S7). How can I pick up this filename dynamically and similarly use it as the filename in the output?

Any help on this will be very much appreciated.

CodePudding user response:

@ECHO OFF
SETLOCAL
rem The following settings for the source directory, destination directory are names
rem that I use for testing and deliberately include names which include spaces to make sure
rem that the process works using such names. These will need to be changed to suit your situation.

SET "sourcedir=u:\your files"
SET "destdir=u:\your results"

FOR %%b IN ("%sourcedir%\*.fasta") DO IF NOT EXIST "           
  •  Tags:  
  • Related