Solved

Determining the computername of a computer through logon script using multiple if statements

Posted on 2006-07-12
2
307 Views
Last Modified: 2012-06-27
Hi guys!

Hope you can help.

We have citrix users that are located in different states throughout Australia.
What I need to do is to determine the first 3 letters of their computer name when they logon to a citrix server, so as to run different parts of a batch file (logon script).

So, the batch will be something like:

IF %COMPUTERNAME%==MUL* goto
IF %COMPUTERNAME%==SIL* goto y
IF %COMPUTERNAME%==ASQ* goto z
else goto end:



:x


:y

:z

:end

Im pretty sure you cant use a wildcard statement with the IF statements.
Can anyone lead me in the right direction please (would really appreciate it).

Thanks guys.

Simon

0
Comment
Question by:Simon336697
2 Comments
 
LVL 83

Accepted Solution

by:
oBdA earned 500 total points
ID: 17088538
Use this:
if /i "%ComputerName:~0,3%"=="MUL" goto x
if /i "%ComputerName:~0,3%"=="SIL" goto y
if /i "%ComputerName:~0,3%"=="ASQ" goto z
This will extract 3 characters from the position 0 in the %computername% variable.
Enter "help set" in a command line for a detailed explanation of this construction.
0
 
LVL 1

Author Comment

by:Simon336697
ID: 17088813
oBdA!

Youre a champion!

Thank you very much!!

Simon
0

Featured Post

Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

by Batuhan Cetin Within the dynamic life of an IT administrator, we hold many information in our minds like user names, passwords, IDs, phone numbers, incomes, service tags, bills and the order from our wives to buy milk when coming back to home.…
Scenerio: You have a server running Server 2003 and have applied a retail pack of Terminal Server Licenses.  You want to change servers or your server has crashed and you need to reapply the Terminal Server Licenses. When you enter the 16-digit lic…
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, Just open a new email message.  In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…
When you create an app prototype with Adobe XD, you can insert system screens -- sharing or Control Center, for example -- with just a few clicks. This video shows you how. You can take the full course on Experts Exchange at http://bit.ly/XDcourse.

743 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

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now