Computing.Net > Forums > Windows XP > dos script to find part of hostname

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

dos script to find part of hostname

Reply to Message Icon

Name: code3hree
Date: January 18, 2005 at 06:47:00 Pacific
OS: xp
CPU/Ram: p4 1gb
Comment:

hi there,

I am trying to find out how to write a script which will run in a scheduler and take certain actions depending on the first 3 chars of a pcs hostname, i cannot work out how to get a statement using FIND and %COMPUTERNAME% to confirm whether or not nhh are the first 3 character in a pcs hostname and if so to then go and do something.

thx in advance



Sponsored Link
Ads by Google

Response Number 1
Name: Mechanix2Go
Date: January 18, 2005 at 07:12:25 Pacific
Reply:

@echo off
ipconfig /all|find "Host Name">hn
set /p name=<hn
set first3=%name:~37,3%
echo %first3%

M2


0

Response Number 2
Name: code3hree
Date: January 19, 2005 at 05:18:05 Pacific
Reply:

thanks a lot for the answer, but it would be even better if you could add some comments as I am not very familiar with this type of scripting


0

Sponsored Link
Ads by Google
Reply to Message Icon

Related Posts

See More







Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Windows XP Forum Home


Sponsored links

Ads by Google


Results for: dos script to find part of hostname

Script to find path of named folder www.computing.net/answers/windows-xp/script-to-find-path-of-named-folder/180878.html

Need bat script to check file size www.computing.net/answers/windows-xp/need-bat-script-to-check-file-size/142283.html

VBS script to find files www.computing.net/answers/windows-xp/vbs-script-to-find-files/156696.html