How can I automate the process of having a software execute over a hundred files as batch files?
-
I am still trying to find easy to implement and not so time consuming solutions. I have a software (on windows) which has the option of taking a text file as input and running it as a batch file. The text file of course has the appropriate commands and input values needed for the software to run those values and export the results. The issue is that I have more than 100 such text files and I have to individually select the option of "Run as batch file" in the software/application/program's GUI. That pops up a message and upon acknowledging that I get another message telling me a log has been exported too. This is time consuming and I am looking at ways to automate this. Any suggestions? Someone recommended using macros if that's of any importance. Assume I have a very basic knowledge about programming.
-
Answer:
I recommend installing Cygwin, which provides a Unix-like environment on Windows. Then, Unix tools like Bash can be used to easily iterate over many directories or files. Conversely, if you are using a programming language like C or Java, you can also do such iterations in the programming language using the respective file I/O APIs.
Jeff Nelson at Quora Visit the source
Other answers
You can use Windows PowerShell cmdlets to automate the task of operating on all the files. here are the cmdlets you can use: Get-Childitem cmdlet: this cmdlet list all the files in given directory. $a=Get-ChildItem -File <directory_name> #this will put all the files in given directory in $a. #$a is an array of all the files. you can operate on #the array in loop #$a.Count Will return number of files. #here is the simple loop which prints the name of files for($i=0;$i -lt $a.count; $i++) { $a[$i].Name } Get-Content: List Names in a Text File. The only purpose of this script is to list the contents of a file line-by-line. # PowerShell script to list each line of a file $File = "E:\PowerShell\Loops\NetworkMachines.txt" Get-Content $File | ForEach-Object { $_ } Let's combine both the scripts. For a given directory we will print the contents of all the files. $a=Get-ChildItem -File <directory_name> for($i=0;$i -lt $a.count; $i++) { $a[$i].Name Get-Content $a[$i].Name | ForEach-Object { $_ } } You can even do lots of string parsing the PowerShell. I would recommend start using reading PowerShell. It is most powerful way to administrator Windows machine.
Raghav Yadav
PowerShell, the automation environment for Windows is the recommended approach. You can also automate whole operating system management tasks in powershell. http://ss64.com/ps/ http://en.m.wikipedia.org/wiki/Windows_PowerShell http://technet.microsoft.com/en-us/scriptcenter/dd742419.aspx
Asher Syed
Bash is ultimately the best solution, but if you want the quick-and-dirty here, just write a batch file that runs all the other batch files.
Mark Whitfield
Related Q & A:
- How can I use a button to retrieve a phone 'number' from contacts?Best solution by Stack Overflow
- How can I convert a string number to a number in Perl?Best solution by Stack Overflow
- How can I get a good deal at a luxury resort?Best solution by lastminute.com
- How can I burn a .rmvb file onto a DVD for viewing on a regular DVD player?Best solution by Yahoo! Answers
- How can I print wirelessly from a laptop to a printer without a router?Best solution by answers.yahoo.com
Just Added Q & A:
- How many active mobile subscribers are there in China?Best solution by Quora
- How to find the right vacation?Best solution by bookit.com
- How To Make Your Own Primer?Best solution by thekrazycouponlady.com
- How do you get the domain & range?Best solution by ChaCha
- How do you open pop up blockers?Best solution by Yahoo! Answers
For every problem there is a solution! Proved by Solucija.
-
Got an issue and looking for advice?
-
Ask Solucija to search every corner of the Web for help.
-
Get workable solutions and helpful tips in a moment.
Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.