/build/static/layout/Breadcrumb_cap_w.png

Bat script for Java install on remote PC's

Hi All,

I am new to the script scene and am in need of some help. I tried searching for some similar posts, but I could not find any. Here's what I am trying to do:
Creating a bat script that asks the user to enter computer name and then the Java version to install. I have 2 bat files, the first one is:
---------------
Java.bat
@echo off
Set /P sysname=(ENTER WORKSTATION NAME)
echo %sysname%
"\\corpfs1\support$\pstools\psexec.exe" \\%sysname% -c "\\centene.com\citrix\XenDtp_Profiles\Redirect\RARNOLD\My Documents\Java\Javainstall.bat"
pause
------------------
That seems to work fine then the bat for the user input:
------------------
Javainstall.bat
net use t: /d
net use t: "\\corpfs1\deploy\Java"

@echo off
set /p var=(Enter Java version to install)
echo %var%
if "%var%"=="1.5u12" GOTO 1.5u12
if "%var%"=="1.5u15" GOTO 1.5u15

:1.5u12
T:
jre-1_5_0_12-windows-i586-p-iftw.exe /q
GOTO END

:1.5u15
T:
jre1.5.0_15.msi /q
GOTO END
--------------------
And for whatever reason, the var variable only returns the 1st character. I tried to use numbers and letters for it and it still only returns the first character of the variable. "Five" would return F, 1.5u15 returns just 1. What am I doing wrong? Should I just be using 1 bat file for this?
Thanks in advance.

0 Comments   [ + ] Show comments

Answers (1)

Posted by: Capital__ 13 years ago
Orange Belt
0
I'm not sure why its only returning one character. I tested the code and it works fine for me. If for some reason you cant figure it out, you could try this method.


ECHO 1. 1.5u12
ECHO 2. 1.5u15

SET /P var=Enter Java version to install (1,2,....).

IF "%var%"=="1" goto 1.5u12
IF "%var%"=="2" goto 1.5u15
Rating comments in this legacy AppDeploy message board thread won't reorder them,
so that the conversation will remain readable.
 
This website uses cookies. By continuing to use this site and/or clicking the "Accept" button you are providing consent Quest Software and its affiliates do NOT sell the Personal Data you provide to us either when you register on our websites or when you do business with us. For more information about our Privacy Policy and our data protection efforts, please visit GDPR-HQ