-1

How do I open a file with a name like "translist-sales.txt.201607290045" in a batch file? I have a folder where many of the file names that I have to open - in Notepad are named like above where only the end number changes by getting bigger. How do I set up a batch file to open one of these files in notepad?

K. Furkan BEK
  • 233
  • 1
  • 2
  • 9
  • Here's a link on how to iterate over files in a folder: http://stackoverflow.com/questions/180741/how-to-do-something-to-each-file-in-a-directory-with-a-batch-script – Nick.Mc Jul 29 '16 at 05:07
  • You can take a look at this code ==> http://stackoverflow.com/questions/38524510/open-a-file-through-cmd-and-display-the-selected-in-specific-editor/38525929#38525929 – Hackoo Jul 29 '16 at 12:45

2 Answers2

0

I think you can use this one:

start notepad C:\translist-sales.txt.201607290045

write this line to an empty txt file, then save it as run_me.bat with ".bat" extension. This must do it.

K. Furkan BEK
  • 233
  • 1
  • 2
  • 9
0

You type notepad followed by it's name.

notepad "c:\somefolder\translist-sales.txt.201607290045" 

Press Winkey + R, type shell:sendto, in the sendto folder right click and select New - Shortcut. Type Notepad in the wizard. Click to the end. Rename it something sensible. Now you can right click any file - Send To - Notepad.