Computing.Net > Forums > Programming > Batch Coding Help

Batch Coding Help

Reply to Message Icon

Original Message
Name: balaco
Date: August 18, 2005 at 16:07:52 Pacific
Subject: Batch Coding Help
OS: Windows XP Proffesional
CPU/Ram: Pentium 4 512 MB RAM
Comment:

I am trying to make a batch that checks if the current logged in user is in a text file. If it is located in the text file then it should do nothing but if it is not then it should logoff the current user.

So far I've got this:
if not %USERNAME% == (this is where i need it to input the list of users individually but I am not sure how to do it) shutdown -l


Report Offensive Message For Removal

Response Number 1
Name: Mechanix2Go
Date: August 18, 2005 at 19:28:56 Pacific
Subject: Batch Coding Help
Reply: (edit)

find "%username%" < textfile
if errorlevel 1 goto :logoff
goto :eof
:logoff
:eof

M2


If at first you don't succeed, you're about average.


Report Offensive Follow Up For Removal

Response Number 2
Name: Pthomass
Date: August 19, 2005 at 02:20:45 Pacific
Subject: Batch Coding Help
Reply: (edit)

Interesting, so one can make sure that NO user can log into that system?

If I put the administrator in that text file, and al other users...

Nice


Report Offensive Follow Up For Removal







Use following form to reply to current message:

   Name: From My Computing.Net Settings
 E-Mail: From My Computing.Net Settings

Subject: Batch Coding Help

Comments:

 


  Homepage URL (*): 
Homepage Title (*): 
         Image URL: 
 
Data Recovery Software