All Forums >> [Scripting] >> Windows PowerShell >> how to make this for loop run more effective? Do you like VisualBasicScript.com? Link to us and help spread the word about our forum. Thanks!
There really isn't any way to count from 1 to 100 or whatever range. Even if you broke the script up so that you could run several scripts concurrently they would each need to be redirected to a separate file and then you'd have to concatenate them. You couldn't have mulitple scripts redirect to the same file. My suggestion is kick the script off at the end of the day and look at the results in the morning.
As a batch file I don't think you can do any better. Did you want to convert this to PowerShell? If so, I think you'll see something much different and faster.
i have little idea about the Windows PowerShell, but now i have installed it. and save the above script to a .bat file and run, but get some error info. i didn't restart my computer. but can you give me some info about the real run time of the above script? if set up the $limit=65536, what time we need to wait for?
because the real result i want to get is just a output txt file of some pre-defined phases with the pre-defined number of times to repeat. so i don't care about how to realize it, just find the simple way.
i first try excel use the embed vbs script as followed
it very simple and powerful, i try 65536 , the work time is less than 2second and also easy to control and operate. but the problem is the row limitation of excel2003 is 65536, so i can't beyond this number to get my desire output.
but some useful info is in excell007 we can beyond this limitation to 1048576, so looks like enough.
anyway thanks, and i am also have a chance to use the powershell because i have install it, i will learn this shell more.
< Message edited by sensen9966 -- 5/15/2007 12:43:47 AM >
What is posted is not a batch file. You could run the commands one at a time in PowerShell or save them to a script with a .ps1 extension. Here's a revised script for you to try:
I just ran it and it finished in 24 seconds. I also discovered that the limit for the array, @(2..$limit) is 50000.
Save this code as Make-Dic.ps1. Open a powerShell prompt and go to the directory where the file is saved. Run: .\make-dic.ps1