-2

Need to pass txt file name to another command. I have folder lets name it folder and have fileXX.txt (number at the end is changing). How can I create batch file that scans folder for tiles *.txt and passes it to another command, like print. So at the end command would look like "print file66.txt"

BB20
  • 1
  • 1
  • 1
    `for %%F in ("c:\pathto\folder\file*.txt") do print "%%~fF"` – Stephan Jan 30 '19 at 12:43
  • Tried to run it, and got ---> %%F was unexpected at this time. – BB20 Jan 30 '19 at 13:17
  • this is batch file syntax. To use it directly from command line, replace each `%%` with a single `%`. (Glad to see that `print` takes wildcards - much easier that way) – Stephan Jan 30 '19 at 14:31

1 Answers1

0

Ok I got myself it with command if, thanks Stephan for help and sorry for another persons time

if EXIST *.txt print *.txt

BB20
  • 1
  • 1