Solved

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

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

What is SQL Server and how does it work?

The purpose of this paper is to provide you background on SQL Server. It’s your self-study guide for learning fundamentals. It includes both the history of SQL and its technical basics. Concepts and definitions will form the solid foundation of your future DBA expertise.

Question has a verified solution.

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

Preface Having the need * to contact many different companies with different infrastructures * do remote maintenance in their network required us to implement a more flexible routing solution. As RAS, PPTP, L2TP and VPN Client connections are no…
A quick step-by-step overview of installing and configuring Carbonite Server Backup.
Along with being a a promotional video for my three-day Annielytics Dashboard Seminor, this Micro Tutorial is an intro to Google Analytics API data.
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…

786 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