Discussion forum for all Windows batch related topics.
Moderator: DosItHelp
-
lalat06bag
- Posts: 51
- Joined: 10 Jan 2018 15:21
#1
Post
by lalat06bag » 05 Apr 2018 14:09
I want to run another batch file when executed on a particular computer. But below script is not working, please suggest.
Code: Select all
@echo off
If "%computername%"=="DXX" (
echo "Computer FOUND"
pause
goto :eof
)
:eof
Exit
Last edited by
Squashman on 05 Apr 2018 14:21, edited 1 time in total.
Reason: MOD EDIT: Please use code tags.
-
Squashman
- Expert
- Posts: 4479
- Joined: 23 Dec 2011 13:59
#2
Post
by Squashman » 05 Apr 2018 14:22
You are positive the computer name is in uppercase?
-
lalat06bag
- Posts: 51
- Joined: 10 Jan 2018 15:21
#3
Post
by lalat06bag » 05 Apr 2018 18:29
With this, computer name shows in upper case. Please see the attachment.
Code: Select all
@echo off
echo %ComputerName%
pause
If "%computername%"=="USER-PC" (
echo Computer FOUND
goto :eof
)
:eof
Exit
-
Attachments
-
- Computer Name
- Capture.PNG (5.02 KiB) Viewed 4670 times
Last edited by
Squashman on 05 Apr 2018 19:25, edited 1 time in total.
Reason: MOD EDIT: Please use code tags.
-
Squashman
- Expert
- Posts: 4479
- Joined: 23 Dec 2011 13:59
#4
Post
by Squashman » 05 Apr 2018 19:23
Turn ECHO ON and lets see all the verbose output of the script running.
You do know you can copy and paste the text in the console window. That is a lot easier then creating a screen shot and posting it here.
Also, could you please be courteous and use code tags with your code. Thanks.
-
lalat06bag
- Posts: 51
- Joined: 10 Jan 2018 15:21
#5
Post
by lalat06bag » 05 Apr 2018 19:44
Hi,
Never mind pls. It worked.
Please ignore the query.