Run .bat file from Flex
Hi,
I'd like to execute a .bat file from Flex. I thought this piece of code should work but no luck
fscommand("Exec", "C:\\Sandbox\\doSomething.bat");
Can someone please point me in the right direction?
Thanks in advance,
Sandbox does not allow external apps to be run in Flex apps. AIR 2.0 may have this.
If this post answered your question or helped, please mark it as such.
Similar Messages
-
Running .bat files from java applications
Has anyone tried to run a .bat file from a java application?
I know I can run java commands by getting the application's runtime, but I've a number of *.bat files I like to run from the application without having to extract the commands from the .bat files.
thks,Crikey! You were answered very shortly after you posted your question, and you STILL haven't bothered to come back. And are you going to create a new userid the next time you ask a question, since bat2004 seems tied to this particular question?
-
Hello,
I have been trying to launch a bat-file from my Java code, running under windows, but with no success.
Here is my simple code:
Runtime.getRuntime().exec(new String[] {
"C:\\temp\\test.bat"
});This does nothing at all and generates no exception. Any suggestions?It seems java has a real problem with this... if you
want to run another java program, for instance, you
cannot do that either with String cmd="cmd.exe /C
java myProgram"
I need to pass parameters from one program into the
program I'm going to open using java, that is why I
need to call it from my first program. It can open
executables and shortcuts, but has a real big problem
doing things with the command line.No it doesn't have a problem with it. You just must be doing something wrong. By the way, since "java(.exe)" is already an executable, there's little value in wrapping that by the "cmd.exe" shell (unless you want to use the command shell for some reason such as passing the redirector (>) symbols to it to let it redirect stdout / stderr to a file) -
Running .bat files from java code
Dear Forum,
I have seen numerous postings on the web about this question, still I have found no answer that works (for me)
I�m trying to run a simple .bat file from a piece of java code , however it does not work. No error message , but still.
Does anyone have a tip?
best regards
temuj
try{
String cmd = "cmd.exe C:\\mybat.bat";
Runtime.getRuntime().exec(cmd);
catch(IOException e){System.out.println("ERROR: "+e);}Message was edited by:
temujin"cmd.exe C:\mybat.bat" is being passed to the OS for execution
what happens when in a terminal/dos window you execute letter for letter:
cmd.exe C:\mybat.bat
The output will be identical to what is happening when java makes this call. -
Is there any way in which we can run a *.bat or *.exe file in
a flex web application.
Will fscommand() work in Web application??
I heard that it is used in AIR applications...AFAIK there is no way to run native apps via Flex.
You can run apps only from projectors (applications created
via publish in Flash), not from swf.
HTH. -
Running bat files from JDeveloper
hi
Sometimes it could be convenient to run a bat file directly from JDeveloper.
For example, the application in SQLAuthenticatorApp-v0.02.zip (see also forum thread "how to disable (or lock) users") has an Ant file BuildStuff/build-wlst.xml which has targets like "wlst.create-domain" and "create.wls-start-stop-bat-files", the last one resulting in some bat files which I have been able to configure to run from JDeveloper,
see http://www.consideringred.com/files/oracle/img/2011/run-using-cmd-20110529.png
The External Tool cmd configuration I use is shown in the screenshot
at http://www.consideringred.com/files/oracle/img/2011/external-tool-cmd-20110529.png
See also the blog post by John 'JB' Brock
at http://blogs.oracle.com/jdevextensions/entry/how_to_extend_jdeveloper_without_writing_code
- (q1) How can I configure the External Tool cmd to run in its own cmd (command) window outside JDeveloper?
many thanks
Jan VerveckenHi Jan,
It looks like this is going to be a bug from what I can see. After looking at it a little more this morning, not only does it not display the cmd window, but if you use the /k argument, it leaves the script running in memory. Look at your Task Manager after running a few times with /k
I'll file a bug, and see if anyone has a work around or something that I missed.
For now, it would appear this is not possible, and you will just have to see the result in the log window. I would not use /k as well. Stick with /c for now.
Sorry for the inconvenience.
--jb -
Running Unit Test from test manager that run bat file from command line
Hi ,
I am trying to run Jsystem (java framewotk) from command line using runScenario.bat thru unit test that i associated to test in test manager.
the idea is that when i ran the automated test from MTM - it will run the the unit test that will run the appropriate test case in java.
i wrote the code like this :
using System;
using Microsoft.VisualStudio.TestTools.UnitTesting;
namespace UnitTestProject3
[TestClass]
public class UnitTest1
[TestMethod]
public void TestMethod1()
try
String command = "c:\\JSYSTEM\\runner\\runScenario.bat
c:\\Users\\ryeshua\\Source\\Workspaces\\Auto1\\my-tests-project\\target\\classes scenarios\\feature1 RoeySetup.xml ";
System.Diagnostics.ProcessStartInfo procStartInfo =
new System.Diagnostics.ProcessStartInfo("cmd", "/c " + command);
procStartInfo.RedirectStandardOutput = true;
procStartInfo.UseShellExecute = false;
//procStartInfo.CreateNoWindow = true;
System.Diagnostics.Process proc = new System.Diagnostics.Process();
proc.StartInfo = procStartInfo;
proc.Start();
string result = proc.StandardOutput.ReadToEnd();
Console.WriteLine(result);
catch (Exception objException)
// Log the exception
and when i ran it from visual studio it worked perfect. and update the Jsystem logs of the junit test in the jsystem/runner/log folder.
but when i added it to associated test and ran it from MTM - it pass but it does not update the logs in jsystem folder.
the problem that i dont know what is not working. i cant see the output of it when i ran from mtm but can see when i ran from VS.
i am using VS 2013 Pro with MTM 2013.
please advice
RoeyHi Roey,
Thank you for posting in MSDN forum.
Based on your issue, could you please tell me how you generate the log file under the jsystem folder?
Generally, I know that when we run unit test from VS IDE, the file will be saved into the local machine. But when we run unit test from MTM, the unit test method will be run on the test agent machine, so the file will be saved into the test agent machine.
Therefore, I suggest you could check if you did not see the updated logs file in jsystem folder on the test agent machine.
In addition, I suggest you could try to copy this unit test project on this test agent machine and then run the unit test method using mstest.exe in command line and then check if you can update the logs file.
https://msdn.microsoft.com/en-us/library/ms182489.aspx?f=255&MSPPError=-2147217396
If you have any updated message about this issue, please tell me.
Best Regards,
We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
Click
HERE to participate the survey. -
how would i go about calling a batch file in java?
a button is clicked that says "RUN" and then I want to run a batch fileHi !!!
Im new to this forums but I think I can help you
You can execute a separate process by using the class Runtime. In this example I execute one batch file located on the same directory the Java App is in.
class Test
public static void main(String a[])
System.out.println("Executing Batch File");
try{
Runtime.getRuntime().exec("Runme.bat");
catch(Exception ex){}
}I hope that could help
see
how would i go about calling a batch file in java?
a button is clicked that says "RUN" and then I want to
run a batch file -
SMS/SCCM & Batch Files - Important notes on running .BAT files from UNC in SMS/SCCM
http://www.myitforum.com/articles/42/view.asp?id=12036
Cheers,
David Goldberg
National Instruments
Software R&DHi,
For the OU's that you are seeing, in the result list you will only see OU's from where you have discovered computers, how have you configured the Active Directory System Discovery agent? this is where you Control which OU's will be used for discovering computers.
AD System Discovery:
LDAP://OU=All Computers
LDAP://CN=Computers
Ok great - I changed my Device Collection to say CN instead of OU for "Computers", but on my device collection I still included my "All Computers" OU and it recognized nothing.
I have updated membership on my Device Collection "All Computers" (Querying OU=All Computers and CN=Computers - this should include all computers on my campus) and still I have 0 member count.
The query of the Device Collection and AD System Discovery are the same. Is this a problem? If so I guess I can go recognize all of the other district. I don't really want to if I can't have a collection with just this domains computers.
"For the installation of the certificate, on XP certutil is not part of the operating System, you have to manually copy that, if that can be the issue. You can use the one from the Windows Server 2003 Administration Tools Pack.."
I downloaded the admin pack for Server 2003 tool pack. Can I just deploy that through SCCM by creating a package with the Server 2003 Tool Pack .EXE? -
Running a Bat file from a stored procedure
This is part II of Re: Need to run bat file from application express
I thought I would open a new thread
I thought I had this fiqured out but it still doesn't work
1) I granted CREATE EXTERNAL JOB to my user
2) startup the OracleJobScheduler Service
3)
create or replace
PROCEDURE RUN_OS_COMMAND(p_cmd IN varchar2)
is
v_job_exists pls_integer:=0;
begin
select count(1)
into v_job_exists
from all_scheduler_jobs
where job_name='JAVA_EXE';
if v_job_exists>0 then
dbms_scheduler.drop_job(job_name =>'JAVA_EXE');
end if;
dbms_scheduler.create_job
( job_name =>'JAVA_EXE'
, job_action =>p_cmd
, job_type =>'executable'
, enabled =>false
, auto_drop =>false
, start_date =>systimestamp
dbms_scheduler.run_job(job_name =>'JAVA_EXE');
end;test.bat is del test.csv
I run this
begin
RUN_OS_COMMAND('C:\temp\test.bat');
end;
/ anonymous block completed
It runs with no errors but does not run the bat file... what am i missing, thanks DougLLUSERSPROFILE=C:\Documents and Settings\All Users
APPDATA=C:\Documents and Settings\wblincoe\Application Data
CLASSPATH=.;[ORACLE_HOME]\jdbc\lib\ojdbc6.jar;c:\myjar\xdocore.jar;c:\myjar\i18nAPI_v3.jar;c:\myjar\xdoparser.jar;c:\myjar\xmlparserv2.jar
CommonProgramFiles=C:\Program Files\Common Files
COMPUTERNAME=WBLINCOELT
ComSpec=C:\WINDOWS\system32\cmd.exe
DEFLOGDIR=C:\Documents and Settings\All Users\Application Data\McAfee\DesktopProtection
FP_NO_HOST_CHECK=NO
HOMEDRIVE=C:
HOMEPATH=\Documents and Settings\wblincoe
LDMS_LOCAL_DIR=C:\Program Files\LANDesk\LDClient\Data
LOGONSERVER=\\03N-DAYT-DC01
NUMBER_OF_PROCESSORS=2
OS=Windows_NT
Path=C:\OraHome_1\jre\1.4.2\bin\client;C:\OraHome_1\jre\1.4.2\bin;C:\app\wblincoe\product\11.1.0\db_1\bin
PATHEXT=.COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH
PERL5LIB=C:\oracle\product\10.2.0\http_1\sysman\admin\scripts;C:\oracle\product\10.2.0\http_1\perl\site\5.6.1\lib;C:\oracle\product\10.2.0\http_1\perl\site\5.6.1;C:\oracle\product\10.2.0\http_1\perl\5.6.1\lib\MSWin32-x86;C:\oracle\product\10.2.0\http_1\perl\lib\5.6.1;C:\oracle\product\10.2.0\http_1\perl\lib\5.6.1\MSWin32-x86;
PHPRC=C:\Program Files\PHP\
PROCESSOR_ARCHITECTURE=x86
PROCESSOR_IDENTIFIER=x86 Family 6 Model 15 Stepping 2, GenuineIntel
PROCESSOR_LEVEL=6
PROCESSOR_REVISION=0f02
ProgramFiles=C:\Program Files
PROMPT=$P$G
SESSIONNAME=Console
SystemDrive=C:
SystemRoot=C:\WINDOWS
TEMP=C:\DOCUME~1\wblincoe\LOCALS~1\Temp
TMP=C:\DOCUME~1\wblincoe\LOCALS~1\Temp
USERDNSDOMAIN=CACI.COM
USERDOMAIN=CACI
USERNAME=wblincoe
USERPROFILE=C:\Documents and Settings\wblincoe
VSEDEFLOGDIR=C:\Documents and Settings\All Users\Application Data\McAfee\DesktopProtection
windir=C:\WINDOWS -
How to call a .bat file from java code?
How to call a .bat file from java code? and how can i pass parameters to that .bat file?
Thanks in advancethanks for ur reply
but still i am getting the same error.
I am trying to run a .bat file of together tool, my code looks like below
import java.lang.Runtime;
import java.lang.Process;
import java.io.File;
class SysCall{
public static void main(String args[]){
String cmd="D://Borland//Together6.2//bin//Together.bat -script:com.togethersoft.modules.qa.QA -metrics out:D://MySamples//Metrics// -fmt:html D://Borland//Together6.2//samples//java//CashSales//CashSales.tpr";
//String path="D://Borland//Together6.2//bin//Together.bat ";
Runtime r= Runtime.getRuntime(); //Declare the system call
try{
System.out.println("Before batch is called");
Process p=r.exec(cmd);
System.out.println(" Exit value =" + p.exitValue());
System.out.println("After batch is called");
/*can produce errors which must be caught*/
catch(Exception e) {
e.printStackTrace();
System.out.println (e.toString());
I am getting the below exception
Before batch is called
java.lang.IllegalThreadStateException: process has not exited
at java.lang.Win32Process.exitValue(Native Method)
at SysCall.main(SysCall.java:17)
java.lang.IllegalThreadStateException: process has not exited -
Creating an xdp file from flex/java application
Hi,
I have an application in Flex 4 and As 3.When I click a button in flex application I have to generate a file in java with
extension xdp.When I try this locally(Run as java application) the file is generating correctly.When i compile the applic
ation and try it, the file is not writing correctly.Do someone have any idea about creating an xdp file from flex application?
i am using blazeds to connect java and flex4.When i opens the file in notepad the file is writing correctly.There is only problem in openig an xdp file...
please help me.specifically:
Runtime.getRuntime().exec("filename.exe") -
Running bat files in java code
Hi,
I am trying to run a .bat file within java code like this.
Runtime.getRuntime().exec("c:\\Test.bat");
but no success. Could you please suggest how to run .bat file or simply a
DOS command from java code.
thanx in advance
Deepak Garg.try this...
n reply whether it worked or not......
import java.util.*;
import java.io.*;
import java.net.*;
try
Runtime runtime = Runtime.getRuntime();
Process process ;
process= runtime.exec("./temp_install");
//code to print command line replies
InputStream stderr = process.getInputStream();
InputStreamReader isr = new InputStreamReader(stderr);
BufferedReader br = new BufferedReader(isr);
String line = null;
while((line=br.readLine())!=null)
System.out.println(line);
catch(Throwable t)
t.printStackTrace();
} -
How to call a exe or bat file from java program
hi,
i actually want to know that how to call a exe or bat file from program so that i can run them parallely.Try this :
String strCmd = "myFile.bat";
try
Runtime rTime = Runtime.getRuntime();
Process process = rTime.exec(strCmd);
InputStream p_in = process.getInputStream();
OutputStream p_out = process.getOutputStream();
InputStream p_err = process.getErrorStream();
p_in.close();
p_out.close();
p_err.close();
catch(Exception e) {
throw new Exception("Unable to start, "+strCmd);
} -
How to write run.bat files
Can anyone tell me how to write run.bat files to run java classes. Currently my run.bat file has the following two lines,
c:\j2sdk1.4.1_02\bin\javac.exe *.java
c:\j2sdk1.4.1_02\bin\java.exe questionnair
But the class is not executed. Thanks in advance.you'll have to provide more details.
Firstly, which package is the class a part of? and secondly, where on the filesystem is the root of the package?
You might also benifit from placing the c:\j2sdk1.4.1_02\bin\ into the classpath.
On a rainy day, check out the ANT tool, it will take care of all that crapola for you.
newio
Maybe you are looking for
-
I need to send a continuous 2-10MHz TTL timing signal to a low pass filter (to set the cutoff frequency) while I collect data from one of the analog inputs. I'm hoping that I can send the TTL signal and collect the data through the same DAQ 6052E boa
-
HP Pavilion dv6-3300se Recovery Fail
Hi I have an HP Pavilion dv6-3300se notebook PC I have encounterd a problem during a system recovery, so when I press F11, an error message appears on the screen and cannot run the recovery. I've re-launched Windows 7 Home Premium again, started comp
-
Find the channel name by file name
Hello, i have some 300 receiver file channels in my PI system. Now my requirement is i have to find the Channel which is created with the target directory as " /interface/test/target " and saving file as " test.xml " in that target directory. if poss
-
System folders in different languages
Hello. I got a new iMac late 2012 and my System folders appear some in English (Music, Sites) and some in Spanish (Pública, Descargas, etc.). I want them all in Spanish. What must I do? Thanks in advance.
-
Tried downloading and installing the 64 bit installer for Windows 7 on new Win7 desktop. Would not connect to the internet. Installed the 32 bit version (after much work to Uninstall all traces of apple software - that process really should be automa