Running console utility via PowerShell - passing commands to it...


i'm beginer powershell, sorry if question dumb. 

i have concole utility (java utility). , .bat file starts it. utility used tasks mange server application including upload data. such task time consumming. need make large number of such actions , want automate process. 

basicly want powershell open utility , pass commands, wait utill process completed, pass command , on.

 

i'm looking answers:

- possible(i'm pretty sure is).

- how pass commands utility when running.

- need rewrite .bat ps script or can use "cmd /c my.bat"

thank answers in advance - stuck issue.

 

 

 

if matter content of .bat file.

@echo off

 

rem set lib dir relative batch file's directory

set lib_dir=%~dp0\..\lib

rem echo lib_dir = %lib_dir%

 

rem slurp command line arguments. loop allows unlimited number

rem of arguments (up command line limit, anyway).

set cmd_line_args=%1

if ""%1""=="""" goto setupargsend

shift

:setupargs

if ""%1""=="""" goto setupargsend

set cmd_line_args=%cmd_line_args% %1

shift

goto setupargs

 

:setupargsend

 

if "%java_home%" == "" goto nojavahome

if not exist "%java_home%\bin\java.exe" goto nojavahome

goto javahome

 

:nojavahome

set java=java

goto javahomeend

 

:javahome

set java=%java_home%\bin\java

 

:javahomeend

 

:checkjdk14

"%java%" -version 2>&1 | findstr "1.4" >nul

if errorlevel 1 goto checkjdk15

echo java 5 or newer required run console

goto end

 

:checkjdk15

"%java%" -version 2>&1 | findstr "1.5" >nul

if errorlevel 1 goto java6

rem use java.ext.dirs hack

rem echo using java.ext.dirs set classpath

"%java%" -djava.ext.dirs="%lib_dir%" org.openrdf.console.console %cmd_line_args%

goto end

 

:java6

rem use java 6 wildcard feature

rem echo using wildcard set classpath

"%java%" -cp "%lib_dir%\*" org.openrdf.console.console %cmd_line_args%

goto end

 

:end


take @ post. talks using sendkeys function common in vbscript days.

http://www.eggheadcafe.com/software/aspnet/31883987/sendkeys-to-cmdexe.aspx

even though have lot of data/commands pass program, assume can read need file , sendkeys function in question.


allan


Windows Server  >  Windows PowerShell



Comments

Popular posts from this blog

2008 Windows Deployment Server Properties Error

Can no longer user MS Update - Files required to use Microsoft Update are no longer registered

How do a find data in one file, search for it in another file and if not found, write a custom message to another file