Solved

need the shell script converted into  ".bat" format

Posted on 2013-01-16
11
649 Views
Last Modified: 2013-01-22
i have a script which runs on linux server and i need the same script to be modified according to windows batch format ( . bat ).
JBoss.sh
0
Comment
Question by:wall3E
  • 6
  • 3
  • 2
11 Comments
 
LVL 3

Expert Comment

by:telczj9
ID: 38785198
"sed", "tail", and "head" are not native to windows platforms.

any particular part of the *.sh script that you would like to zero in?

alternatively you could install cigwin to make you shell scripts work in windows.

Cheers!
0
 
LVL 51

Expert Comment

by:Bill Prew
ID: 38785292
What do all the "echo ... >/dev/null" lines do, that feels like it doesn't do or show anything?

~bp
0
 
LVL 51

Expert Comment

by:Bill Prew
ID: 38785564
Okay, here's a start. But there are a few open questions.

- There isn't a uname -a equivalent in Windows, what information exactly do you want there?

- The head, tail, and sed commands aren't easily translated to DOS commands, but we could certainly create a very small VBS script that the BAT script could call to display the desired lines from the file, would that be okay? Or would you rather download Windows versions of those utils and use those?

@echo off
setlocal

set HOSTNAME=%COMPUTERNAME%

echo aab0f5f8-e28e-4082-9a05-cc0f0b8fe191 %HOSTNAME% c530dd5c-4e5f-4339-a3d1-c67da6e287ef >NUL
echo 6c9d8e83-4931-4b78-ade1-8de95a437653 %HOSTNAME%--APS0110 24d297ad-0198-43f3-9b0d-f46b8e79f8b4 >NUL
date
REM uname -a
java -version
echo ########################################################################
echo We use internal CA Certs policy 4.99.02
echo ########################################################################
date
echo c08852d7-c39f-4f46-bad3-4896a9c7cffa %HOSTNAME%--APS0110 11e9f587-a132-4de4-930f-ac6076ecba14 >NUL
echo 6c9d8e83-4931-4b78-ade1-8de95a437653 %HOSTNAME%--APS0130 24d297ad-0198-43f3-9b0d-f46b8e79f8b4 >NUL
date
REM uname -a
java -version
echo ########################################################################
echo We use internal CA Certs policy 4.99.02
echo ########################################################################
date
echo c08852d7-c39f-4f46-bad3-4896a9c7cffa %HOSTNAME%--APS0130 11e9f587-a132-4de4-930f-ac6076ecba14 >NUL
echo 6c9d8e83-4931-4b78-ade1-8de95a437653 %HOSTNAME%--APS0140 24d297ad-0198-43f3-9b0d-f46b8e79f8b4 >NUL
date
REM uname -a
java -version
cd \app\jboss\jboss-5.1.0.GA\server\configured-apps\deploy\jmx-console.war\WEB-INF\
echo.%CD%
sed -n '90,123p' web.xml
date
echo c08852d7-c39f-4f46-bad3-4896a9c7cffa %HOSTNAME%--APS0140 11e9f587-a132-4de4-930f-ac6076ecba14 >NUL
echo 6c9d8e83-4931-4b78-ade1-8de95a437653 %HOSTNAME%--APS0210 24d297ad-0198-43f3-9b0d-f46b8e79f8b4 >NUL
date
REM uname -a
java -version
cd \app\jboss\jboss-5.1.0.GA\server\configured-apps\conf\props
echo.%CD%
dir /o-d
type jmx-console-users.properties
date
echo c08852d7-c39f-4f46-bad3-4896a9c7cffa %HOSTNAME%--APS0210 11e9f587-a132-4de4-930f-ac6076ecba14 >NUL
echo 6c9d8e83-4931-4b78-ade1-8de95a437653 %HOSTNAME%--APS0310 24d297ad-0198-43f3-9b0d-f46b8e79f8b4 >NUL
date
REM uname -a
java -version
cd \app\jboss\jboss-5.1.0.GA\server\configured-apps\conf
echo.%CD%
tail -50 login-config.xml
date
echo c08852d7-c39f-4f46-bad3-4896a9c7cffa %HOSTNAME%--APS0310 11e9f587-a132-4de4-930f-ac6076ecba14 >NUL
echo 6c9d8e83-4931-4b78-ade1-8de95a437653 %HOSTNAME%--APS0320 24d297ad-0198-43f3-9b0d-f46b8e79f8b4 >NUL
date
REM uname -a
java -version
cd \app\jboss\jboss-5.1.0.GA\server\configured-apps\deploy\jboss-web.deployer
echo.%CD%
head -35 server.xml
date
echo c08852d7-c39f-4f46-bad3-4896a9c7cffa %HOSTNAME%--APS0320 11e9f587-a132-4de4-930f-ac6076ecba14 >NUL
echo 6c9d8e83-4931-4b78-ade1-8de95a437653 %HOSTNAME%--APS0350 24d297ad-0198-43f3-9b0d-f46b8e79f8b4 >NUL
date
REM uname -a
java -version
cd \app\jboss\jboss-5.1.0.GA\server\configured-apps\deploy\jboss-web.deployer
echo.%CD%
head -35 server.xml
date
echo c08852d7-c39f-4f46-bad3-4896a9c7cffa %HOSTNAME%--APS0350 11e9f587-a132-4de4-930f-ac6076ecba14 >NUL
echo 6c9d8e83-4931-4b78-ade1-8de95a437653 %HOSTNAME%--APS0410 24d297ad-0198-43f3-9b0d-f46b8e79f8b4 >NUL
date
REM uname -a
java -version
echo ########################################################################
echo We use internal CA Certs policy 4.99.02
echo ########################################################################
date
echo c08852d7-c39f-4f46-bad3-4896a9c7cffa %HOSTNAME%--APS0410 11e9f587-a132-4de4-930f-ac6076ecba14 >NUL
echo 6c9d8e83-4931-4b78-ade1-8de95a437653 %HOSTNAME%--APS0510 24d297ad-0198-43f3-9b0d-f46b8e79f8b4 >NUL
date
REM uname -a
java -version
cd \app\jboss\jboss-5.1.0.GA\server\configured-apps\deploy\jmx-console.war\WEB-INF\
echo.%CD%
sed -n '90,123p' web.xml
date
echo c08852d7-c39f-4f46-bad3-4896a9c7cffa %HOSTNAME%--APS0510 11e9f587-a132-4de4-930f-ac6076ecba14 >NUL
echo 6c9d8e83-4931-4b78-ade1-8de95a437653 %HOSTNAME%--APS0530 24d297ad-0198-43f3-9b0d-f46b8e79f8b4 >NUL
date
REM uname -a
java -version
cd \app\jboss\jboss-5.1.0.GA\server\configured-apps\deploy\jboss-web.deployer\conf
echo.%CD%
more web.xml | grep -i session
date
echo c08852d7-c39f-4f46-bad3-4896a9c7cffa %HOSTNAME%--APS0530 11e9f587-a132-4de4-930f-ac6076ecba14 >NUL
echo 6c9d8e83-4931-4b78-ade1-8de95a437653 %HOSTNAME%--APS0540 24d297ad-0198-43f3-9b0d-f46b8e79f8b4 >NUL
date
REM uname -a
java -version
cd \app\jboss\jboss-5.1.0.GA\server\configured-apps\deploy
echo.%CD%
dir /o-d
date
echo c08852d7-c39f-4f46-bad3-4896a9c7cffa %HOSTNAME%--APS0540 11e9f587-a132-4de4-930f-ac6076ecba14 >NUL
echo 6c9d8e83-4931-4b78-ade1-8de95a437653 %HOSTNAME%--APS0560 24d297ad-0198-43f3-9b0d-f46b8e79f8b4 >NUL
date
REM uname -a
java -version
cd \app\jboss\jboss-5.1.0.GA\server\configured-apps\deploy\jboss-web.deployer
echo.%CD%
head -35 server.xml
date
echo c08852d7-c39f-4f46-bad3-4896a9c7cffa %HOSTNAME%--APS0560 11e9f587-a132-4de4-930f-ac6076ecba14 >NUL
echo 6c9d8e83-4931-4b78-ade1-8de95a437653 %HOSTNAME%--APS0580 24d297ad-0198-43f3-9b0d-f46b8e79f8b4 >NUL
date
REM uname -a
java -version
cd \app\jboss\jboss-5.1.0.GA\server\configured-apps\conf
echo.%CD%
dir /o-d
copy login-config.xml login-config.xml.latest
date
echo c08852d7-c39f-4f46-bad3-4896a9c7cffa %HOSTNAME%--APS0580 11e9f587-a132-4de4-930f-ac6076ecba14 >NUL
echo 6c9d8e83-4931-4b78-ade1-8de95a437653 %HOSTNAME%--APS0590 24d297ad-0198-43f3-9b0d-f46b8e79f8b4 >NUL
date
REM uname -a
java -version
echo ########################################################################
echo We use 4.06.02 - Acceptable Use Policy - IT System Administrator Access Control Policy
echo ########################################################################
date
echo c08852d7-c39f-4f46-bad3-4896a9c7cffa %HOSTNAME%--APS0590 11e9f587-a132-4de4-930f-ac6076ecba14 >NUL
echo 6c9d8e83-4931-4b78-ade1-8de95a437653 %HOSTNAME%--APS0615 24d297ad-0198-43f3-9b0d-f46b8e79f8b4 >NUL
date
REM uname -a
java -version
cd \app\jboss\jboss-5.1.0.GA\server\configured-apps\deploy
echo.%CD%
df -h
date
echo c08852d7-c39f-4f46-bad3-4896a9c7cffa %HOSTNAME%--APS0615 11e9f587-a132-4de4-930f-ac6076ecba14 >NUL
echo 6c9d8e83-4931-4b78-ade1-8de95a437653 %HOSTNAME%--APS0630 24d297ad-0198-43f3-9b0d-f46b8e79f8b4 >NUL
date
REM uname -a
java -version
cd \app\jboss\jboss-5.1.0.GA\server\configured-apps\deploy\jmx-console.war\META-INF
dir /o-d
type MANIFEST.MF
date
echo c08852d7-c39f-4f46-bad3-4896a9c7cffa %HOSTNAME%--APS0630 11e9f587-a132-4de4-930f-ac6076ecba14 >NUL
echo 6c9d8e83-4931-4b78-ade1-8de95a437653 %HOSTNAME%--APS0670 24d297ad-0198-43f3-9b0d-f46b8e79f8b4 >NUL
date
REM uname -a
java -version
cd \app\jboss\jboss-5.1.0.GA\server\configured-apps\deploy
echo.%CD%
dir /o-d
date
echo c08852d7-c39f-4f46-bad3-4896a9c7cffa %HOSTNAME%--APS0670 11e9f587-a132-4de4-930f-ac6076ecba14 >NUL
echo 6c9d8e83-4931-4b78-ade1-8de95a437653 %HOSTNAME%--APS0720 24d297ad-0198-43f3-9b0d-f46b8e79f8b4 >NUL
date
REM uname -a
java -version
echo ########################################################################
echo Display IP Adress 192.168.218.116.
echo ########################################################################
date
echo c08852d7-c39f-4f46-bad3-4896a9c7cffa %HOSTNAME%--APS0720 11e9f587-a132-4de4-930f-ac6076ecba14 >NUL
echo 6c9d8e83-4931-4b78-ade1-8de95a437653 %HOSTNAME%--APS0730 24d297ad-0198-43f3-9b0d-f46b8e79f8b4 >NUL
date
REM uname -a
java -version
echo ########################################################################
echo We use 4.12.00 - Business Contingency and Continuity Planning - General
echo ########################################################################
date
echo c08852d7-c39f-4f46-bad3-4896a9c7cffa %HOSTNAME%--APS0730 11e9f587-a132-4de4-930f-ac6076ecba14 >NUL
echo 6c9d8e83-4931-4b78-ade1-8de95a437653 %HOSTNAME%--APS0740 24d297ad-0198-43f3-9b0d-f46b8e79f8b4 >NUL
date
REM uname -a
java -version
echo ########################################################################
echo We use 4.12.01 - Backup and Retention Policy
echo ########################################################################
date
echo c08852d7-c39f-4f46-bad3-4896a9c7cffa %HOSTNAME%--APS0740 11e9f587-a132-4de4-930f-ac6076ecba14 >NUL
echo 6c9d8e83-4931-4b78-ade1-8de95a437653 %HOSTNAME%--APS0810 24d297ad-0198-43f3-9b0d-f46b8e79f8b4 >NUL
date
REM uname -a
java -version
echo ########################################################################
echo We use 4.06.02 - Acceptable Use Policy - IT System Administrator Access Control Policy
echo ########################################################################
date
echo c08852d7-c39f-4f46-bad3-4896a9c7cffa %HOSTNAME%--APS0810 11e9f587-a132-4de4-930f-ac6076ecba14 >NUL
echo 6c9d8e83-4931-4b78-ade1-8de95a437653 %HOSTNAME%--ASG0520 24d297ad-0198-43f3-9b0d-f46b8e79f8b4 >NUL
date
REM uname -a
java -version
cd \app\jboss\jboss-5.1.0.GA\server\configured-apps\conf
echo.%CD%
tail -50 login-config.xml
date
echo c08852d7-c39f-4f46-bad3-4896a9c7cffa %HOSTNAME%--ASG0520 11e9f587-a132-4de4-930f-ac6076ecba14 >NUL
echo 6c9d8e83-4931-4b78-ade1-8de95a437653 %HOSTNAME%--ASG0750 24d297ad-0198-43f3-9b0d-f46b8e79f8b4 >NUL
date
REM uname -a
java -version
echo ########################################################################
echo We use IT Logging and Monitoring 4.17.03 Policy
echo ########################################################################
date
echo c08852d7-c39f-4f46-bad3-4896a9c7cffa %HOSTNAME%--ASG0750 11e9f587-a132-4de4-930f-ac6076ecba14 >NUL
echo 6c9d8e83-4931-4b78-ade1-8de95a437653 %HOSTNAME%--ASG0760 24d297ad-0198-43f3-9b0d-f46b8e79f8b4 >NUL
date
REM uname -a
java -version
cd \etc
type group
cd \app\jboss\jboss-5.1.0.GA\server\configured-apps\deploy
dir /o-d
date
echo c08852d7-c39f-4f46-bad3-4896a9c7cffa %HOSTNAME%--ASG0760 11e9f587-a132-4de4-930f-ac6076ecba14 >NUL
echo 6c9d8e83-4931-4b78-ade1-8de95a437653 %HOSTNAME%--ASJ0120 24d297ad-0198-43f3-9b0d-f46b8e79f8b4 >NUL
date
REM uname -a
java -version
echo ########################################################################
echo We use internal CA Certs policy 4.99.02
echo ########################################################################
date
echo c08852d7-c39f-4f46-bad3-4896a9c7cffa %HOSTNAME%--ASJ0120 11e9f587-a132-4de4-930f-ac6076ecba14 >NUL
echo 6c9d8e83-4931-4b78-ade1-8de95a437653 %HOSTNAME%--ASJ0330 24d297ad-0198-43f3-9b0d-f46b8e79f8b4 >NUL
date
REM uname -a
java -version
cd \usr\jre\lib\security
echo.%CD%
ls -lrt java.policy
date
echo c08852d7-c39f-4f46-bad3-4896a9c7cffa %HOSTNAME%--ASJ0330 11e9f587-a132-4de4-930f-ac6076ecba14 >NUL
echo 6c9d8e83-4931-4b78-ade1-8de95a437653 %HOSTNAME%--ASJ0840 24d297ad-0198-43f3-9b0d-f46b8e79f8b4 >NUL
date
REM uname -a
java -version
cd \usr\jre\lib\security
echo.%CD%
ls -lrt java.security
date
echo c08852d7-c39f-4f46-bad3-4896a9c7cffa %HOSTNAME%--ASJ0840 11e9f587-a132-4de4-930f-ac6076ecba14 >NUL
echo 6c9d8e83-4931-4b78-ade1-8de95a437653 %HOSTNAME%--AST0310 24d297ad-0198-43f3-9b0d-f46b8e79f8b4 >NUL
date
REM uname -a
java -version
cd \app\jboss\jboss-5.1.0.GA\server\configured-apps\conf
echo.%CD%
tail -50 login-config.xml
date
echo c08852d7-c39f-4f46-bad3-4896a9c7cffa %HOSTNAME%--AST0310 11e9f587-a132-4de4-930f-ac6076ecba14 >NUL
echo 6c9d8e83-4931-4b78-ade1-8de95a437653 %HOSTNAME%--AST0340 24d297ad-0198-43f3-9b0d-f46b8e79f8b4 >NUL
date
REM uname -a
java -version
cd \etc
type group
cd \app\jboss\jboss-5.1.0.GA\server\configured-apps\deploy
dir /o-d
date
echo c08852d7-c39f-4f46-bad3-4896a9c7cffa %HOSTNAME%--AST0340 11e9f587-a132-4de4-930f-ac6076ecba14 >NUL
echo 6c9d8e83-4931-4b78-ade1-8de95a437653 %HOSTNAME%--AST0580 24d297ad-0198-43f3-9b0d-f46b8e79f8b4 >NUL
date
REM uname -a
java -version
cd \app\jboss\jboss-5.1.0.GA\server\configured-apps\conf\props
echo.%CD%
dir /o-d
type jmx-console-users.properties
date
echo c08852d7-c39f-4f46-bad3-4896a9c7cffa %HOSTNAME%--AST0580 11e9f587-a132-4de4-930f-ac6076ecba14 >NUL
echo 6c9d8e83-4931-4b78-ade1-8de95a437653 %HOSTNAME%--AST0610 24d297ad-0198-43f3-9b0d-f46b8e79f8b4 >NUL
date
REM uname -a
java -version
cd \app\jboss\jboss-5.1.0.GA\server\configured-apps\conf\props
echo.%CD%
dir /o-d
type jmx-console-users.properties
date
echo c08852d7-c39f-4f46-bad3-4896a9c7cffa %HOSTNAME%--AST0610 11e9f587-a132-4de4-930f-ac6076ecba14 >NUL
echo 6c9d8e83-4931-4b78-ade1-8de95a437653 %HOSTNAME%--AST0710 24d297ad-0198-43f3-9b0d-f46b8e79f8b4 >NUL
date
REM uname -a
java -version
cd \app\jboss\jboss-5.1.0.GA\server\configured-apps\conf\props
echo.%CD%
#telnet 192.188.78.20 1414
#telnet junior1 1414
date
echo c08852d7-c39f-4f46-bad3-4896a9c7cffa %HOSTNAME%--AST0710 11e9f587-a132-4de4-930f-ac6076ecba14 >NUL
echo 6c9d8e83-4931-4b78-ade1-8de95a437653 %HOSTNAME%--AST0820 24d297ad-0198-43f3-9b0d-f46b8e79f8b4 >NUL
date
REM uname -a
java -version
cd \app\jboss\jboss-5.1.0.GA\server\configured-apps\conf
echo.%CD%
tail -50 login-config.xml
date
echo c08852d7-c39f-4f46-bad3-4896a9c7cffa %HOSTNAME%--AST0820 11e9f587-a132-4de4-930f-ac6076ecba14 >NUL
echo 6c9d8e83-4931-4b78-ade1-8de95a437653 %HOSTNAME%--AST0830 24d297ad-0198-43f3-9b0d-f46b8e79f8b4 >NUL
date
REM uname -a
java -version
cd \app\jboss\jboss-5.1.0.GA\server\configured-apps\deploy\jmx-console.war\WEB-INF
echo.%CD%
sed -n '90,123p' web.xml
date
echo c08852d7-c39f-4f46-bad3-4896a9c7cffa %HOSTNAME%--AST0830 11e9f587-a132-4de4-930f-ac6076ecba14 >NUL
echo fba47450-7eba-4f58-80a6-33e5a31d1c82 %HOSTNAME% 69a1222d-87ec-44b3-b179-21c9fd1d8faa >NUL

Open in new window

~bp
0
 

Author Comment

by:wall3E
ID: 38787373
1) uname -a --> i am trying to get information of the version of the linux in which my application server is running and that is same for windows also. i need the version of the windows in which my software is running.

2) i guess small vb script works for me.
0
 
LVL 51

Accepted Solution

by:
Bill Prew earned 500 total points
ID: 38790016
Okay, here's the BAT file, followed by the small getlines.vbs script.

@echo off
setlocal

set HOSTNAME=%COMPUTERNAME%

echo aab0f5f8-e28e-4082-9a05-cc0f0b8fe191 %HOSTNAME% c530dd5c-4e5f-4339-a3d1-c67da6e287ef >NUL
echo 6c9d8e83-4931-4b78-ade1-8de95a437653 %HOSTNAME%--APS0110 24d297ad-0198-43f3-9b0d-f46b8e79f8b4 >NUL
date
ver
java -version
echo ########################################################################
echo We use internal CA Certs policy 4.99.02
echo ########################################################################
date
echo c08852d7-c39f-4f46-bad3-4896a9c7cffa %HOSTNAME%--APS0110 11e9f587-a132-4de4-930f-ac6076ecba14 >NUL
echo 6c9d8e83-4931-4b78-ade1-8de95a437653 %HOSTNAME%--APS0130 24d297ad-0198-43f3-9b0d-f46b8e79f8b4 >NUL
date
ver
java -version
echo ########################################################################
echo We use internal CA Certs policy 4.99.02
echo ########################################################################
date
echo c08852d7-c39f-4f46-bad3-4896a9c7cffa %HOSTNAME%--APS0130 11e9f587-a132-4de4-930f-ac6076ecba14 >NUL
echo 6c9d8e83-4931-4b78-ade1-8de95a437653 %HOSTNAME%--APS0140 24d297ad-0198-43f3-9b0d-f46b8e79f8b4 >NUL
date
ver
java -version
cd \app\jboss\jboss-5.1.0.GA\server\configured-apps\deploy\jmx-console.war\WEB-INF\
echo.%CD%
cscript //nologo getlines.vbs web.xml 90 33
date
echo c08852d7-c39f-4f46-bad3-4896a9c7cffa %HOSTNAME%--APS0140 11e9f587-a132-4de4-930f-ac6076ecba14 >NUL
echo 6c9d8e83-4931-4b78-ade1-8de95a437653 %HOSTNAME%--APS0210 24d297ad-0198-43f3-9b0d-f46b8e79f8b4 >NUL
date
ver
java -version
cd \app\jboss\jboss-5.1.0.GA\server\configured-apps\conf\props
echo.%CD%
dir /o-d
type jmx-console-users.properties
date
echo c08852d7-c39f-4f46-bad3-4896a9c7cffa %HOSTNAME%--APS0210 11e9f587-a132-4de4-930f-ac6076ecba14 >NUL
echo 6c9d8e83-4931-4b78-ade1-8de95a437653 %HOSTNAME%--APS0310 24d297ad-0198-43f3-9b0d-f46b8e79f8b4 >NUL
date
ver
java -version
cd \app\jboss\jboss-5.1.0.GA\server\configured-apps\conf
echo.%CD%
cscript //nologo getlines.vbs login-config.xml -1 50
date
echo c08852d7-c39f-4f46-bad3-4896a9c7cffa %HOSTNAME%--APS0310 11e9f587-a132-4de4-930f-ac6076ecba14 >NUL
echo 6c9d8e83-4931-4b78-ade1-8de95a437653 %HOSTNAME%--APS0320 24d297ad-0198-43f3-9b0d-f46b8e79f8b4 >NUL
date
ver
java -version
cd \app\jboss\jboss-5.1.0.GA\server\configured-apps\deploy\jboss-web.deployer
echo.%CD%
cscript //nologo getlines.vbs server.xml 1 35
date
echo c08852d7-c39f-4f46-bad3-4896a9c7cffa %HOSTNAME%--APS0320 11e9f587-a132-4de4-930f-ac6076ecba14 >NUL
echo 6c9d8e83-4931-4b78-ade1-8de95a437653 %HOSTNAME%--APS0350 24d297ad-0198-43f3-9b0d-f46b8e79f8b4 >NUL
date
ver
java -version
cd \app\jboss\jboss-5.1.0.GA\server\configured-apps\deploy\jboss-web.deployer
echo.%CD%
head -35 server.xml
cscript //nologo getlines.vbs server.xml 1 35
date
echo c08852d7-c39f-4f46-bad3-4896a9c7cffa %HOSTNAME%--APS0350 11e9f587-a132-4de4-930f-ac6076ecba14 >NUL
echo 6c9d8e83-4931-4b78-ade1-8de95a437653 %HOSTNAME%--APS0410 24d297ad-0198-43f3-9b0d-f46b8e79f8b4 >NUL
date
ver
java -version
echo ########################################################################
echo We use internal CA Certs policy 4.99.02
echo ########################################################################
date
echo c08852d7-c39f-4f46-bad3-4896a9c7cffa %HOSTNAME%--APS0410 11e9f587-a132-4de4-930f-ac6076ecba14 >NUL
echo 6c9d8e83-4931-4b78-ade1-8de95a437653 %HOSTNAME%--APS0510 24d297ad-0198-43f3-9b0d-f46b8e79f8b4 >NUL
date
ver
java -version
cd \app\jboss\jboss-5.1.0.GA\server\configured-apps\deploy\jmx-console.war\WEB-INF\
echo.%CD%
sed -n '90,123p' web.xml
cscript //nologo getlines.vbs web.xml 90 33
date
echo c08852d7-c39f-4f46-bad3-4896a9c7cffa %HOSTNAME%--APS0510 11e9f587-a132-4de4-930f-ac6076ecba14 >NUL
echo 6c9d8e83-4931-4b78-ade1-8de95a437653 %HOSTNAME%--APS0530 24d297ad-0198-43f3-9b0d-f46b8e79f8b4 >NUL
date
ver
java -version
cd \app\jboss\jboss-5.1.0.GA\server\configured-apps\deploy\jboss-web.deployer\conf
echo.%CD%
find -i web.xml "session"
date
echo c08852d7-c39f-4f46-bad3-4896a9c7cffa %HOSTNAME%--APS0530 11e9f587-a132-4de4-930f-ac6076ecba14 >NUL
echo 6c9d8e83-4931-4b78-ade1-8de95a437653 %HOSTNAME%--APS0540 24d297ad-0198-43f3-9b0d-f46b8e79f8b4 >NUL
date
ver
java -version
cd \app\jboss\jboss-5.1.0.GA\server\configured-apps\deploy
echo.%CD%
dir /o-d
date
echo c08852d7-c39f-4f46-bad3-4896a9c7cffa %HOSTNAME%--APS0540 11e9f587-a132-4de4-930f-ac6076ecba14 >NUL
echo 6c9d8e83-4931-4b78-ade1-8de95a437653 %HOSTNAME%--APS0560 24d297ad-0198-43f3-9b0d-f46b8e79f8b4 >NUL
date
ver
java -version
cd \app\jboss\jboss-5.1.0.GA\server\configured-apps\deploy\jboss-web.deployer
echo.%CD%
head -35 server.xml
cscript //nologo getlines.vbs server.xml 1 35
date
echo c08852d7-c39f-4f46-bad3-4896a9c7cffa %HOSTNAME%--APS0560 11e9f587-a132-4de4-930f-ac6076ecba14 >NUL
echo 6c9d8e83-4931-4b78-ade1-8de95a437653 %HOSTNAME%--APS0580 24d297ad-0198-43f3-9b0d-f46b8e79f8b4 >NUL
date
ver
java -version
cd \app\jboss\jboss-5.1.0.GA\server\configured-apps\conf
echo.%CD%
dir /o-d
copy login-config.xml login-config.xml.latest
date
echo c08852d7-c39f-4f46-bad3-4896a9c7cffa %HOSTNAME%--APS0580 11e9f587-a132-4de4-930f-ac6076ecba14 >NUL
echo 6c9d8e83-4931-4b78-ade1-8de95a437653 %HOSTNAME%--APS0590 24d297ad-0198-43f3-9b0d-f46b8e79f8b4 >NUL
date
ver
java -version
echo ########################################################################
echo We use 4.06.02 - Acceptable Use Policy - IT System Administrator Access Control Policy
echo ########################################################################
date
echo c08852d7-c39f-4f46-bad3-4896a9c7cffa %HOSTNAME%--APS0590 11e9f587-a132-4de4-930f-ac6076ecba14 >NUL
echo 6c9d8e83-4931-4b78-ade1-8de95a437653 %HOSTNAME%--APS0615 24d297ad-0198-43f3-9b0d-f46b8e79f8b4 >NUL
date
ver
java -version
cd \app\jboss\jboss-5.1.0.GA\server\configured-apps\deploy
echo.%CD%
REM df -h
date
echo c08852d7-c39f-4f46-bad3-4896a9c7cffa %HOSTNAME%--APS0615 11e9f587-a132-4de4-930f-ac6076ecba14 >NUL
echo 6c9d8e83-4931-4b78-ade1-8de95a437653 %HOSTNAME%--APS0630 24d297ad-0198-43f3-9b0d-f46b8e79f8b4 >NUL
date
ver
java -version
cd \app\jboss\jboss-5.1.0.GA\server\configured-apps\deploy\jmx-console.war\META-INF
dir /o-d
type MANIFEST.MF
date
echo c08852d7-c39f-4f46-bad3-4896a9c7cffa %HOSTNAME%--APS0630 11e9f587-a132-4de4-930f-ac6076ecba14 >NUL
echo 6c9d8e83-4931-4b78-ade1-8de95a437653 %HOSTNAME%--APS0670 24d297ad-0198-43f3-9b0d-f46b8e79f8b4 >NUL
date
ver
java -version
cd \app\jboss\jboss-5.1.0.GA\server\configured-apps\deploy
echo.%CD%
dir /o-d
date
echo c08852d7-c39f-4f46-bad3-4896a9c7cffa %HOSTNAME%--APS0670 11e9f587-a132-4de4-930f-ac6076ecba14 >NUL
echo 6c9d8e83-4931-4b78-ade1-8de95a437653 %HOSTNAME%--APS0720 24d297ad-0198-43f3-9b0d-f46b8e79f8b4 >NUL
date
ver
java -version
echo ########################################################################
echo Display IP Adress 192.168.218.116.
echo ########################################################################
date
echo c08852d7-c39f-4f46-bad3-4896a9c7cffa %HOSTNAME%--APS0720 11e9f587-a132-4de4-930f-ac6076ecba14 >NUL
echo 6c9d8e83-4931-4b78-ade1-8de95a437653 %HOSTNAME%--APS0730 24d297ad-0198-43f3-9b0d-f46b8e79f8b4 >NUL
date
ver
java -version
echo ########################################################################
echo We use 4.12.00 - Business Contingency and Continuity Planning - General
echo ########################################################################
date
echo c08852d7-c39f-4f46-bad3-4896a9c7cffa %HOSTNAME%--APS0730 11e9f587-a132-4de4-930f-ac6076ecba14 >NUL
echo 6c9d8e83-4931-4b78-ade1-8de95a437653 %HOSTNAME%--APS0740 24d297ad-0198-43f3-9b0d-f46b8e79f8b4 >NUL
date
ver
java -version
echo ########################################################################
echo We use 4.12.01 - Backup and Retention Policy
echo ########################################################################
date
echo c08852d7-c39f-4f46-bad3-4896a9c7cffa %HOSTNAME%--APS0740 11e9f587-a132-4de4-930f-ac6076ecba14 >NUL
echo 6c9d8e83-4931-4b78-ade1-8de95a437653 %HOSTNAME%--APS0810 24d297ad-0198-43f3-9b0d-f46b8e79f8b4 >NUL
date
ver
java -version
echo ########################################################################
echo We use 4.06.02 - Acceptable Use Policy - IT System Administrator Access Control Policy
echo ########################################################################
date
echo c08852d7-c39f-4f46-bad3-4896a9c7cffa %HOSTNAME%--APS0810 11e9f587-a132-4de4-930f-ac6076ecba14 >NUL
echo 6c9d8e83-4931-4b78-ade1-8de95a437653 %HOSTNAME%--ASG0520 24d297ad-0198-43f3-9b0d-f46b8e79f8b4 >NUL
date
ver
java -version
cd \app\jboss\jboss-5.1.0.GA\server\configured-apps\conf
echo.%CD%
cscript //nologo getlines.vbs login-config.xml -1 50
date
echo c08852d7-c39f-4f46-bad3-4896a9c7cffa %HOSTNAME%--ASG0520 11e9f587-a132-4de4-930f-ac6076ecba14 >NUL
echo 6c9d8e83-4931-4b78-ade1-8de95a437653 %HOSTNAME%--ASG0750 24d297ad-0198-43f3-9b0d-f46b8e79f8b4 >NUL
date
ver
java -version
echo ########################################################################
echo We use IT Logging and Monitoring 4.17.03 Policy
echo ########################################################################
date
echo c08852d7-c39f-4f46-bad3-4896a9c7cffa %HOSTNAME%--ASG0750 11e9f587-a132-4de4-930f-ac6076ecba14 >NUL
echo 6c9d8e83-4931-4b78-ade1-8de95a437653 %HOSTNAME%--ASG0760 24d297ad-0198-43f3-9b0d-f46b8e79f8b4 >NUL
date
ver
java -version
cd \etc
type group
cd \app\jboss\jboss-5.1.0.GA\server\configured-apps\deploy
dir /o-d
date
echo c08852d7-c39f-4f46-bad3-4896a9c7cffa %HOSTNAME%--ASG0760 11e9f587-a132-4de4-930f-ac6076ecba14 >NUL
echo 6c9d8e83-4931-4b78-ade1-8de95a437653 %HOSTNAME%--ASJ0120 24d297ad-0198-43f3-9b0d-f46b8e79f8b4 >NUL
date
ver
java -version
echo ########################################################################
echo We use internal CA Certs policy 4.99.02
echo ########################################################################
date
echo c08852d7-c39f-4f46-bad3-4896a9c7cffa %HOSTNAME%--ASJ0120 11e9f587-a132-4de4-930f-ac6076ecba14 >NUL
echo 6c9d8e83-4931-4b78-ade1-8de95a437653 %HOSTNAME%--ASJ0330 24d297ad-0198-43f3-9b0d-f46b8e79f8b4 >NUL
date
ver
java -version
cd \usr\jre\lib\security
echo.%CD%
dir /o-d java.policy
date
echo c08852d7-c39f-4f46-bad3-4896a9c7cffa %HOSTNAME%--ASJ0330 11e9f587-a132-4de4-930f-ac6076ecba14 >NUL
echo 6c9d8e83-4931-4b78-ade1-8de95a437653 %HOSTNAME%--ASJ0840 24d297ad-0198-43f3-9b0d-f46b8e79f8b4 >NUL
date
ver
java -version
cd \usr\jre\lib\security
echo.%CD%
dir /o-d java.security
date
echo c08852d7-c39f-4f46-bad3-4896a9c7cffa %HOSTNAME%--ASJ0840 11e9f587-a132-4de4-930f-ac6076ecba14 >NUL
echo 6c9d8e83-4931-4b78-ade1-8de95a437653 %HOSTNAME%--AST0310 24d297ad-0198-43f3-9b0d-f46b8e79f8b4 >NUL
date
ver
java -version
cd \app\jboss\jboss-5.1.0.GA\server\configured-apps\conf
echo.%CD%
cscript //nologo getlines.vbs login-config.xml -1 50
date
echo c08852d7-c39f-4f46-bad3-4896a9c7cffa %HOSTNAME%--AST0310 11e9f587-a132-4de4-930f-ac6076ecba14 >NUL
echo 6c9d8e83-4931-4b78-ade1-8de95a437653 %HOSTNAME%--AST0340 24d297ad-0198-43f3-9b0d-f46b8e79f8b4 >NUL
date
ver
java -version
cd \etc
type group
cd \app\jboss\jboss-5.1.0.GA\server\configured-apps\deploy
dir /o-d
date
echo c08852d7-c39f-4f46-bad3-4896a9c7cffa %HOSTNAME%--AST0340 11e9f587-a132-4de4-930f-ac6076ecba14 >NUL
echo 6c9d8e83-4931-4b78-ade1-8de95a437653 %HOSTNAME%--AST0580 24d297ad-0198-43f3-9b0d-f46b8e79f8b4 >NUL
date
ver
java -version
cd \app\jboss\jboss-5.1.0.GA\server\configured-apps\conf\props
echo.%CD%
dir /o-d
type jmx-console-users.properties
date
echo c08852d7-c39f-4f46-bad3-4896a9c7cffa %HOSTNAME%--AST0580 11e9f587-a132-4de4-930f-ac6076ecba14 >NUL
echo 6c9d8e83-4931-4b78-ade1-8de95a437653 %HOSTNAME%--AST0610 24d297ad-0198-43f3-9b0d-f46b8e79f8b4 >NUL
date
ver
java -version
cd \app\jboss\jboss-5.1.0.GA\server\configured-apps\conf\props
echo.%CD%
dir /o-d
type jmx-console-users.properties
date
echo c08852d7-c39f-4f46-bad3-4896a9c7cffa %HOSTNAME%--AST0610 11e9f587-a132-4de4-930f-ac6076ecba14 >NUL
echo 6c9d8e83-4931-4b78-ade1-8de95a437653 %HOSTNAME%--AST0710 24d297ad-0198-43f3-9b0d-f46b8e79f8b4 >NUL
date
ver
java -version
cd \app\jboss\jboss-5.1.0.GA\server\configured-apps\conf\props
echo.%CD%
REM #telnet 192.188.78.20 1414
REM #telnet junior1 1414
date
echo c08852d7-c39f-4f46-bad3-4896a9c7cffa %HOSTNAME%--AST0710 11e9f587-a132-4de4-930f-ac6076ecba14 >NUL
echo 6c9d8e83-4931-4b78-ade1-8de95a437653 %HOSTNAME%--AST0820 24d297ad-0198-43f3-9b0d-f46b8e79f8b4 >NUL
date
ver
java -version
cd \app\jboss\jboss-5.1.0.GA\server\configured-apps\conf
echo.%CD%
cscript //nologo getlines.vbs login-config.xml -1 50
date
echo c08852d7-c39f-4f46-bad3-4896a9c7cffa %HOSTNAME%--AST0820 11e9f587-a132-4de4-930f-ac6076ecba14 >NUL
echo 6c9d8e83-4931-4b78-ade1-8de95a437653 %HOSTNAME%--AST0830 24d297ad-0198-43f3-9b0d-f46b8e79f8b4 >NUL
date
ver
java -version
cd \app\jboss\jboss-5.1.0.GA\server\configured-apps\deploy\jmx-console.war\WEB-INF
echo.%CD%
cscript //nologo getlines.vbs web.xml 90 33
date
echo c08852d7-c39f-4f46-bad3-4896a9c7cffa %HOSTNAME%--AST0830 11e9f587-a132-4de4-930f-ac6076ecba14 >NUL
echo fba47450-7eba-4f58-80a6-33e5a31d1c82 %HOSTNAME% 69a1222d-87ec-44b3-b179-21c9fd1d8faa >NUL

Open in new window

' Define needed constants
Const ForReading = 1
Const TriStateUseDefault = -2

' Get input file name from command line
If (WScript.Arguments.Count > 0) Then
  sFile = WScript.Arguments(0)
Else
  Wscript.Echo "No filename specified."
  ShowUsage
  WScript.Quit
End If

' Get starting line to display from command line
If (WScript.Arguments.Count > 1) Then
  iLineFrom = CInt(WScript.Arguments(1))
Else
  iLineFrom = 1
  iLineCount = 10
End If

' Get number of lines to display from command line
If (WScript.Arguments.Count > 2) Then
  iLineCount = CInt(WScript.Arguments(2))
Else
  iLineCount = 10
End If

' Create file system object
Set oFSO = CreateObject("Scripting.FileSystemObject")

' Read entire input file into a variable and close it
Set oFile = oFSO.OpenTextFile(sFile, ForReading, False, TriStateUseDefault)
sData = oFile.ReadAll
oFile.Close
Set oFile = Nothing

' Split lines into array elements
aLines = Split(sData, vbCrLf)
iLastLine = UBound(aLines)

' Exit if empty file
If iLastLine = 0 Then Wscript.Quit

' Is this a "tail" type request?
If iLineFrom = -1 Then
   iLineFrom = iLastLine - iLineCount
End If

' Don't start before first line
if iLineFrom < 1 Then iLineFrom = 1

' If asking for lines beyond end of file, exit
If iLineFrom > iLastLine Then Wscript.Quit

For i = (iLineFrom - 1) To (iLineFrom + iLineCount - 2)
   If i < iLastLine Then Wscript.Echo aLines(i)
Next

' Cleanup and end
Set oFSO = Nothing
Wscript.Quit

Sub ShowUsage()
   Wscript.Echo vbCrLf & "Usage: getlines.vbs filename [start-line] [number-of-lines]" & vbCrLf
   Wscript.Echo "Where: filename = the file to display lines from"
   Wscript.Echo "       start-line = the first line to display (default is 1, -1 implies end of file like 'tail')"
   Wscript.Echo "       number-of-lines = the count of lines to display (default is 10)"
End Sub

Open in new window

~bp
0
PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

 
LVL 3

Expert Comment

by:telczj9
ID: 38795020
Wow!

Bill, very elegant way for replacing tail, head, and "sed -n" in windows cli!!!

One miniscule detail I noticed was that tailing was not giving me the very last line, updating line 47 in getlines.vbs
   iLineFrom = iLastLine - iLineCount

Open in new window

with the line below did the trick
   iLineFrom = ( iLastLine + 1) - iLineCount 

Open in new window


wall3E,

note that the command date in windows, will be waiting for input from unless you give it the /t switch to just output the current date date /t.

Cheers!
0
 

Author Comment

by:wall3E
ID: 38795111
yea.. i have noticed that .. it is asking me date continously..

i took off the date and replaced simply

echo Current date/time is %date%, %time%.

Thank you
0
 
LVL 51

Expert Comment

by:Bill Prew
ID: 38795612
Interesting, I did some "tail" testing could have sworn I got the right lines, I wonder if you have an extra CRLF at the end compared to me, or vice versa.  Will have to look at that a bit more.

Sorry about the date snafu, both comments are correct, and I'd go with the ECHO approach I think if you want to label the date and time and have on the same line.
I'm sure a few other things may need adjusting, but hoped this gave you a decent leg up.

~bp
0
 
LVL 51

Expert Comment

by:Bill Prew
ID: 38799538
Okay, here's a corrected and slightly improved getlines.vbs.

' Define needed constants
Const ForReading = 1
Const TriStateUseDefault = -2

' Get input file name from command line
If (WScript.Arguments.Count > 0) Then
  sFile = WScript.Arguments(0)
Else
  Wscript.Echo "No filename specified."
  ShowUsage
  WScript.Quit
End If

' Get starting line to display from command line
If (WScript.Arguments.Count > 1) Then
  iLineFrom = CInt(WScript.Arguments(1))
Else
  iLineFrom = 1
  iLineCount = 10
End If

' Get number of lines to display from command line
If (WScript.Arguments.Count > 2) Then
  iLineCount = CInt(WScript.Arguments(2))
Else
  iLineCount = 10
End If

' Create file system object
Set oFSO = CreateObject("Scripting.FileSystemObject")

' Read entire input file into a variable and close it
Set oFile = oFSO.OpenTextFile(sFile, ForReading, False, TriStateUseDefault)
sData = oFile.ReadAll
oFile.Close
Set oFile = Nothing

' Split lines into array elements
If Right(sData, 2) = vbCrLf Then sData = Left(sData, Len(sData)-2)
aLines = Split(sData, vbCrLf)
iLastLine = UBound(aLines)

' Exit if empty file
If iLastLine = 0 Then Wscript.Quit

' Is this a "tail" type request?
If iLineFrom = -1 Then
   iLineFrom = iLastLine - iLineCount + 1
Else
   iLineFrom = iLineFrom - 1
End If

' Don't start before first line
if iLineFrom < 0 Then iLineFrom = 0

' If asking for lines beyond end of file, exit
If iLineFrom > iLastLine Then Wscript.Quit

For i = (iLineFrom) To (iLineFrom + iLineCount - 1)
   If i <= iLastLine Then Wscript.Echo aLines(i)
Next

' Cleanup and end
Set oFSO = Nothing
Wscript.Quit

Sub ShowUsage()
   Wscript.Echo vbCrLf & "Usage: getlines.vbs filename [start-line] [number-of-lines]" & vbCrLf
   Wscript.Echo "Where: filename = the file to display lines from"
   Wscript.Echo "       start-line = the first line to display (default is 1, -1 implies end of file like 'tail')"
   Wscript.Echo "       number-of-lines = the count of lines to display (default is 10)"
End Sub

Open in new window

~bp
0
 

Author Closing Comment

by:wall3E
ID: 38807682
Thanks alot
0
 
LVL 51

Expert Comment

by:Bill Prew
ID: 38807689
Welcome.

~bp
0

Featured Post

Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

Join & Write a Comment

This Windows batch file is useful for organizing image files from a digital camera or other source, but can have many other uses.  It simply renames the file(s) to match their create date.  For example, if you took a picture today at 1:40pm and the …
Utilizing an array to gracefully append to a list of EmailAddresses
Learn several ways to interact with files and get file information from the bash shell. ls lists the contents of a directory: Using the -a flag displays hidden files: Using the -l flag formats the output in a long list: The file command gives us mor…
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…

743 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

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now