Solved

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

Posted on 2006-07-12
2
311 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

Netscaler Common Configuration How To guides

If you use NetScaler you will want to see these guides. The NetScaler How To Guides show administrators how to get NetScaler up and configured by providing instructions for common scenarios and some not so common ones.

Question has a verified solution.

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

This may not be a text book method to resolve VSS backup issues but it seemed to have worked on few of the Windows 2003 servers we had issues while performing a Volume Shadow Copy backup. If you have issues while performing a shadow copy backup usin…
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…
This tutorial demonstrates a quick way of adding group price to multiple Magento products.
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…

930 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

8 Experts available now in Live!

Get 1:1 Help Now