[jboss-user] [Javassist user questions] - How do I automate close of Windows comand line Interface?
leaustin
do-not-reply at jboss.com
Wed Jun 27 12:03:42 EDT 2007
When script below runs, the Windows CLI remains open until manually closed. I want to run as a background process but, need to force the CLI to close once the command has executed to prevent the process from hanging. Any/All suggetions appreciated.
Thanks, lea
main();
function main()
{
// get contents of the \\stlmombhftp1\MKSTest\Outbound folder and load into array fc
var fso, f, f1, fc, intIndex;
fso = new ActiveXObject("Scripting.FileSystemObject");
f = fso.GetFolder("//stlmombhftp1/MKSTest/Outbound");
fc = new Enumerator(f.files);
// for each file found in array fc, attach to the issue, copy file to the
// \\stlmombhftp1\MKSTest\ArchiveOutbound and remove from \\stlmombhftp1\MKSTest\Outbound.
for (; !fc.atEnd(); fc.moveNext())
{
// extract the filepath from \\stlmombhftp1\MKSTest\Outbound forward and extract the ID number
// from the filename and create the file destination variable for later use in moving the file.
var strfilepath = fc.item();
var strfilesource = String(strfilepath);
var strfilename = String(strfilepath);
intIndex=strfilename.lastIndexOf("RP");
strfilename=strfilename.substr(intIndex);
var strid=strfilename.substr(2,4);
// write the cli command and execute.
var strcli = "im editissue --port=7001 --hostname=stlmoapp07 --user=MKSScript --password=P2bbl357 --addAttachment='" + strfilepath + "' " + strid;
var WshShell = new ActiveXObject("Wscript.Shell");
var oExec=WshShell.Exec(strcli);
// WScript.Echo(strcli);
// oExec.StdOut.ReadAll();
// move the file to the ArchiveOutbound directory and remove from the Outbound directory
var strfiledest=strfilesource.substr(0,23) + "ArchiveOutbound\\" + strfilename;
var strfiledup=strfilesource.substr(0,23) + "ArchiveOutbound\\Dup" + strfilename;
if (fso.FileExists(strfiledest)) {
if (fso.FileExists(strfiledup)) {
fso.CopyFile(strfilesource,strfiledup);
fso.DeleteFile(strfilesource); }
else {
fso.MoveFile(strfilesource,strfiledup); }
}
else {
fso.MoveFile(strfilesource,strfiledest); }
}
}
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4058281#4058281
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4058281
More information about the jboss-user
mailing list