Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Batch files in DOS

Status
Not open for further replies.

KyoAD

Technical User
Aug 5, 2002
106
SG
Is there a way to generate random strings in a msdos batch file?

I am trying to create a dos network boot disk which will automatically generate a computer name so that there will be no duplicate names.
 
try the "BASIC: Microsoft" forum, they are pretty helpful on DOS and batch type stuff
 
Is there some reason why it must be in batch? It will be a relatively toyal pain in the a** in batch but relatively trivial in VBs.

[red]"... isn't sanity really just a one trick pony anyway?! I mean, all you get is one trick, rational thinking, but when you are good and crazy, oooh, oooh, oooh, the sky is the limit!" - The Tick[/red]
 
It is not really a MUST to do it in batch. But how can i get to do the same thing using vbs?
 
In VBScript:
Code:
Option Explicit

Dim nWordSize:nWordSize = 8
Dim strWord:strWord = ""
Dim i
Randomize
For i = 1 To nWordSize
	strWord = strWord & Chr(64 + Int((26 * Rnd) + 1))
Next
WScript.Echo strWord


[red]"... isn't sanity really just a one trick pony anyway?! I mean, all you get is one trick, rational thinking, but when you are good and crazy, oooh, oooh, oooh, the sky is the limit!" - The Tick[/red]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top