Re: about iterative loop to write numbers into file



"Alexander Mueller" <millerax@xxxxxxxxxxx> wrote in message
news:473a4459$0$27122$9b4e6d93@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
crazyfisher schrieb:
Dear all,
just wondering is it possible to create a VBS script that uses an
iterative
loop to write the numbers from 1.0 to 1.9, then 2.0 to 2.9 etc up to a
text
file?
How could I do that ?
Thanks !!!

Here's a shell script, numbers.cmd:

@ECHO OFF
SET F=%TMP%\numbers.txt
ECHO. > %F%
setlocal enabledelayedexpansion
FOR /L %%A in (1,1,99) do (
IF %%A LSS 10 (
SET S=0%%A
) ELSE (
SET S=%%A
)
ECHO !S:~,-1!.!S:~-1! >> %F%
)
endlocal
TYPE %F%

Alex, the OP asked for a VBScript ....

For i = 1.0 To 3.0 Step 0.1 : s = s & FormatNumber(i,1) & vbCrLf : Next
CreateObject("Scripting.FileSystemObject").CreateTextFile("i.txt",True).Writ
e(s)


.



Relevant Pages

  • To get file details echoed
    ... I have written a .VBS script where it runs FTp command to get the file ... details on to a file and echo the contents of this file. ... PS I have confirmed ftp.exe command is working ..but msgbox is not ...
    (microsoft.public.scripting.wsh)
  • Re: Running task scheduler under normal user
    ... echo %date% %time% Start of job> c:\test.log ... > scheduled task under system or administrator. ... > VBS script was not executed. ... >> user has the right to log in as a batch job. ...
    (microsoft.public.win2000.general)
  • Re: Script works well, but not as scheduled tasks ?
    ... Here is my vbs script called shutdown.vbs. ... Set objConnection = Wscript.createObject ... echo %date% %time%>> c:\test.txt ... I start the schelude task. ...
    (microsoft.public.scripting.vbscript)
  • Re: pass variable from DOS to VBS
    ... ID's I need to reset the pwdlastset value to a -1. ... VBS script. ... use the file ref'd in my above DOS script for a VBS script? ... @echo off ...
    (microsoft.public.scripting.vbscript)
  • Re: Writing Shell script to interactively control another shell script??
    ... 10: exec 5<&p ... Say you want to write a shell script to control another simple menu ... echo "1 - Check Status and other stuff " ... if "Program is running fine" then Press 3 to exit ...
    (comp.unix.shell)

Loading