Hey Sajha Computer Gurus, I am new to programming , pls help.. help. I have a makefile.exe program that takes a file(.txt ) format and changes to different format (.ms). it works in command line(DOS) like this C:\> makefile.exe filename.txt -ms ( it creats filename.ms), But I have to run several( thousands) of those .txt file that need to be change in .ms format. I am wondering how can I give a command so that the it works automatically for all the text file that are in a folder. i am looking some line of codes (in any programming languge) batch file or in command line mode. I really need this urgently, Thanks, Slife (FYI: file names are format are not real)
secondlife · Aug 20, 2009 10:38 PM · 11,094 views
Try reading the files in vbcsript,, create a loop to read the file in a folder once the file is read, fire makefile.exe filename.txt -ms do until there is no file in the folder.. simple
pyaradeshbasiharu · Aug 20, 2009 10:49 PM
Just to make ur life easier Set objFSO = CreateObject("Scripting.FileSystemObject") objStartFolder = "C:\Scripts" Set objFolder = objFSO.GetFolder(objStartFolder) Set colFiles = objFolder.Files For Each objFile in colFiles 'ur command to create .ms file goes here 'eg wscript.run makefile.exe filename.txt -ms Next Disclaimer: not a fullcode
pyaradeshbasiharu · Aug 20, 2009 11:01 PM
Payaradeshbashiharu, Thanks for your quick response, can you pls provide me few more line of code(would be great if it's complete). I have no idea about vb script... though i have visual studio in my system. pls Thanks slife
secondlife · Aug 20, 2009 11:03 PM
Dim aWSHShell, bWSHShell ,cSet aWSHShell = CreateObject("WScript.Shell") Set objFSO = CreateObject("Scripting.FileSystemObject") objStartFolder = "C:\Scripts" 'Ur folder path Set objFolder = objFSO.GetFolder(objStartFolder) Set colFiles = objFolder.Files For Each objFile in colFiles c=objFile.Name 'variable to hold file name aWSHShell.Run "makefile.exe c -ms " Next I don't have a Windows Box ...and haven't tested it ..but if there's any error minor tweak will do the trick.. save the above code with .vbs extension..to execute the code simply right click and open it... hope it helps u
pyaradeshbasiharu · Aug 20, 2009 11:14 PM
Payaradeshbashiharu, Thanks alot for your great help, It worked (made some modification), but it just gave me one output(just for 1 file) as i mentioned earlier i need a loop so that it should do for all the file. how to make just read 1 file at a time and modify that and take next file................... ? Cheers! I really appreciate your help and humbled by your support Slife
secondlife · Aug 21, 2009 12:02 AM
pyaradeshbasiharu, Thanks for all your support, though it created a file on required format, it's just a templete( just ~50kb size) actually it should be bigger one. and also I need the .ms file name same as .txt file. complete code would be great, thanks a lot. Cheers! slife
secondlife · Aug 21, 2009 10:24 AM
http://www.activexperts.com/ac... U will get the Answer here...Look at "Changing File Extensions"..Minor tweaks in program will help u..
pyaradeshbasiharu · Aug 21, 2009 11:23 AM
This conversation is preserved exactly as it was on the original Sajha.com and can't accept new replies.
Start a New Discussion