Hi, I need a simple batch file to edit multiple .txt files in a folder. The text files contain hourly stock prices. The stock code (ticker) in each source file is shown as a single digit followed by ".HK". For example: [login to view URL], [login to view URL], [login to view URL], 2347.HK.
I need to convert these stock codes into 4 digits (so need to pad them out with zeros) so the resulting ticker codes would become: [login to view URL], [login to view URL], [login to view URL], [login to view URL] etc (so the batch file only needs to process the files which aren't already 4 digits, i.e. from 1-999).
Each file also need to be renamed from "[login to view URL]" to "0001.HK.txt." Examples of before and after files are attached.
Additional notes: The batch file will be used on Windows 10 (and Windows 11 in the future) and should run on a single click without asking for any input from the user. Any kind of compatible batch file will be ok as long as I can edit it in the future (.bat or powershell etc).
hey, I have completed this project already and am ready to deliver! Heres an example of the output:
PS > ls
[login to view URL] [login to view URL] [login to view URL]
PS > powershell ./[login to view URL]
PS > ls
[login to view URL] [login to view URL] [login to view URL]