Tom's Guide | Tom's Hardware | Tom's Games
![]() |
![]() |
![]() |
Hi everyone,
STRIVE here.I am not a programmer. I hardly ever have to write my own scripts. Batch files is about the extent of what I do. I am a windows system admin.
I have a batch file to add shares to a cluster and I want to get it to use parameters and then pull the answers from a txt or csv file. Or I want input boxes to pop up for the answers.
Here is what I have.
cluster resource "MGMT1$" /create /group:"Group 00" /Type:"File Share"
cluster resource "MGMT1$" /priv Security=Everyone,set,R:security
cluster resource "MGMT1$" /priv Security=Administrators,set,F:security
cluster resource "MGMT1$" /adddep:"Disk V:"
cluster resource "MGMT1$" /priv ShareName=MGMT1$
cluster resource "MGMT1$" /priv Path="V:\MGMT1"
cluster resource "MGMT1$" /priv Remark=Fuji
cluster resource "MGMT1$" /onThis works like a champ, but I need to repeat it 50 times with different "Share Names, Disk, and Path"
The next one would look like this.
cluster resource "ATHMT1$" /create /group:"Group 00" /Type:"File Share"
cluster resource "ATHMT1$" /priv Security=Everyone,set,R:security
cluster resource "ATHMT1$" /priv Security=Administrators,set,F:security
cluster resource "ATHMT1$" /adddep:"Disk T:"
cluster resource "ATHMT1$" /priv ShareName=ATHMT1$
cluster resource "ATHMT1$" /priv Path="T:\ATHMT1"
cluster resource "ATHMT1$" /priv Remark=Fuji
cluster resource "ATHMT1$" /onSo, any help will be appreciated. Thanks,
STRIVE

Unless your shares stop following that predictable formula, all you really need is the path. Being an admin, I'm just going to assume you know what to do with %1.
FOR /F "delims=" %%a IN (%1) DO (
cluster resource "%%~Na$" /create /group:"Group 00" /Type:"File Share"
cluster resource "%%~Na$" /priv Security=Everyone,set,R:security
cluster resource "%%~Na$" /priv Security=Administrators,set,F:security
cluster resource "%%~Na$" /adddep:"Disk %%~Da"
cluster resource "%%~Na$" /priv ShareName=%%~Na$
cluster resource "%%~Na$" /priv Path="%%a"
cluster resource "%%~Na$" /priv Remark=Fuji
cluster resource "%%~Na$" /on)
For reference, your input file should look like:V:\MGMT1Win admins unite?
T:\ATHMT1EDIT: Fixed, per klint's suggestion.

Razor, shouldn't that be FOR /F %%a IN (%1) ?
(I assume %1 is the name of a file containing lines that go into %%a.)

![]() |
![]() |
![]() |

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.
| Ads by Google |