Solved

Batch file to install software for all users in a text file

Posted on 2014-07-31
3
676 Views
Last Modified: 2014-07-31
Need assistance with command syntax.
I am adding the domain username to a text file. For each of the usersnames in the text file, I want to run a command.

I am going to add this to a login script eventually.

I need it to operate as such:

If %username% == ( a name in user.txt) then run extra commands

I am attempting to get this working with a for loop on the names in the text file.

For %%i in my/users.txt do START /wait install.exe

all users who need the software will have their domain username in the txt file.

I an unable to get this working.
0
Comment
Question by:zequestioner
3 Comments
 
LVL 5

Expert Comment

by:amac81
ID: 40232364
You could add them all to a security group and then use 'ifmember' to make it work.  A for loop in this scenario sounds like the login could be slow as it loops through the list of names.
0
 
LVL 9

Expert Comment

by:David Carr
ID: 40232368
Use FOR /F %%i
0
 
LVL 69

Accepted Solution

by:
Qlemo earned 500 total points
ID: 40232401
All you'll need is
find /i "%username%" \\server\share\user.txt  >nul && \\server\share\install.cmd

Open in new window

This will search the text file for the (exact, caseinsensitive) match of the current username, and if found execute the other batch (and not return to this batch).
0

Featured Post

Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

TOMORROW TOMORROW.BAT is inspired by a question I get asked over and over again; that is, "How can I use batch file commands to obtain tomorrow's date?" The crux of this batch file revolves around the XCOPY command - a technique I discovered w…
In this tutorial I will show you how to provide a dynamic RTF document on your website generated with data from your database. For this tutorial you will need Microsoft Word or WordPad, WhizBase and Microsoft Access. In this tutorial I will show …
The viewer will learn how to dynamically set the form action using jQuery.
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.

785 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question