Solved

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

Posted on 2006-07-12
2
319 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 84

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

PeopleSoft Has Never Been Easier

PeopleSoft Adoption Made Smooth & Simple!

On-The-Job Training Is made Intuitive & Easy With WalkMe's On-Screen Guidance Tool.  Claim Your Free WalkMe Account Now

Question has a verified solution.

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

Organizations create, modify, and maintain huge amounts of data to help their businesses earn money and generally function.  Typically every network user within an organization has a bit of disk space to store in process items and personal files.   …
Numerous times I have been asked this questions that what is it that makes my machine log on so slow, there have been cases where computers took 23 minute exactly after taking password and getting to the desktop. Interesting thing was the fact th…
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…

730 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