Solved

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

Posted on 2014-07-31
3
682 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

Guide to Performance: Optimization & Monitoring

Nowadays, monitoring is a mixture of tools, systems, and codes—making it a very complex process. And with this complexity, comes variables for failure. Get DZone’s new Guide to Performance to learn how to proactively find these variables and solve them before a disruption occurs.

Question has a verified solution.

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

Suggested Solutions

I hope you'll find this tutorial useful and interesting. So let's try to extend Tcl with a new package.  For anyone more deeply interested please check out the book "Practical Programming in Tcl and Tk". It's really one of the best written books abo…
In threads here at EE, each comment has a unique Identifier (ID). It is easy to get the full path for an ID via the right-click context menu. However, we often want to post a short link within a thread rather than the full link. This article shows a…
The viewer will learn how to dynamically set the form action using jQuery.
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…

685 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