DOS Command Schtasks - error
Hello,
I am locally executing a batch file which contains the following:
SchTasks /query /fo csv > C:\AllReports\Schedtask.txt /v /s AppServer.xyz.org
I do get the ouptut file along with the requested info but I also get the following:
ERROR: The task XML contains a value which is incorrectly formatted or out of range
ERROR: Task cannot be loaded: UpsizeToSQL - Special Run - is the first line withing the output file. Subsequent lines show actual Schtasks results
Appserver.xyz.org is a remote server I am able to access to using my network credentials. I am able to run Schtasks from the command line without issues and get a results clean of error messages. The issue appears when I execute the batch file from my local
machine to retrieve tasks on that remote server.
Any help to find a solution would be much appreciated.
Thank you.
Hello,
I locally executing a batch file which contains the following:
SchTasks /query /fo csv > C:\AllReports\Schedtask.txt /v /s AppServer.xyz.org
I do get the ouptut file along with the requested info but I also get the following:
ERROR: The task XML contains a value which is incorrectly formatted or out of range
ERROR: Task cannot be loaded: UpsizeToSQL - Special Run - is the first line withing the output file. Subsequent lines show actual Schtasks results
Appserver.xyz.org is a remote server I am able to access to using my network credentials. I am able to run Schtasks from the command line without issues and get a results clean of error messages. The issue appears when I execute the batch file from my local
machine to retrieve tasks on that remote server.
Any help to find a solution would be much appreciated.
Thank you.
Hi,
Since this issue is mainly related to Dos Commands, I would recommend you refer to the following thread to get where to get supports for this issue.
Where is the Forum for DOS Commands
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.
Similar Messages
-
Error while running DOS command in Java
Hi all,
I use "runtime" class to execute a DOS command "copy C:\\pathname\\*.* C:\\backupPathname\\". But I saw an error msg "CreateProcess: copy C:\pathname\*.* C:\backupPathname\ error=2".
I did create a folder C:\backupPathname\ before running the DOS command.
Pls help me all Java genius.I ended up writing a small 'c' program and pasing the command in to it from java. The problem seems to be that in dos, unlike unix, the copy command is not a program, rather the command is interpreted by the command.com program.
-
Error using DOS Command from Java
Hi,
I am using the following code to execute the DOS command to delete a file from Java.
cmd = "del " + fileName;
Runtime run = Runtime.getRuntime();
Process proc = run.exec(cmd);
Getting the following exception during runt time.
Exception = java.io.IOException: CreateProcess: del D:\LAWDOCS\P50074\12\3\36857.3 error=2 --
Can some body throw light on this?.
Thanks,
Jeyaraman R"del" is not an actual executable file, but instead a command in the command interpreter. So you can't just execute del like that, you have to run the command interpreter and tell it to execute the del command.
If you are on windows NT, 2000 or XP, replace your command with "cmd /C del " + filename.
If you are on Windows 95, 98 or ME, use "command /C del " + filename. (I am not quite sure if the switch for this is called /C on old windows version.)
(But why not use File.delete()?) -
Error 57 in invoking sqlplus command from DOS command prompt in Oracle Serv
I have a Oracle 11G server which has suddenly shutdown due to power cut-off. Now when I restart the system and trying to connect to database invoking the sqlplus as sysdba from DOS command prompt - I am getting following errors
C:\Documents and Settings\Administrator>sqlplus "/as sysdba"
Error 57 initializing SQL*Plus
Error loading message shared library
Can anyone help me please ?Yes sure!! .. The details of alert logs for today is herewith -
Thu Feb 28 12:30:02 2013
kewastUnPackStats(): bad magic 1 (0x0DFE82DA, 0)
kewastUnPackStats(): bad magic 1 (0x0DFE82DA, 0)
Thu Feb 28 12:36:02 2013
Errors in file d:\app\collbrs\diag\rdbms\collbrs\collbrs\trace\collbrs_ckpt_3160.trc:
ORA-00202: control file: 'D:\APP\COLLBRS\ORADATA\COLLBRS\CONTROL01.CTL'
ORA-27070: async read/write failed
OSD-04006: ReadFile() failure, unable to read from file
O/S-Error: (OS 1117) The request could not be performed because of an I/O device error.
Thu Feb 28 12:36:19 2013
Errors in file d:\app\collbrs\diag\rdbms\collbrs\collbrs\trace\collbrs_m000_5180.trc:
ORA-00202: control file: 'D:\APP\COLLBRS\ORADATA\COLLBRS\CONTROL01.CTL'
ORA-27070: async read/write failed
OSD-04006: ReadFile() failure, unable to read from file
O/S-Error: (OS 1117) The request could not be performed because of an I/O device error.
Errors in file d:\app\collbrs\diag\rdbms\collbrs\collbrs\trace\collbrs_m000_5180.trc:
ORA-00204: error in reading (block 1, # blocks 1) of control file
ORA-00202: control file: 'D:\APP\COLLBRS\ORADATA\COLLBRS\CONTROL01.CTL'
ORA-27070: async read/write failed
OSD-04006: ReadFile() failure, unable to read from file
O/S-Error: (OS 1117) The request could not be performed because of an I/O device error.
Thu Feb 28 12:36:40 2013
Errors in file d:\app\collbrs\diag\rdbms\collbrs\collbrs\trace\collbrs_ckpt_3160.trc:
ORA-00202: control file: 'D:\APP\COLLBRS\ORADATA\COLLBRS\CONTROL01.CTL'
ORA-27070: async read/write failed
OSD-04006: ReadFile() failure, unable to read from file
O/S-Error: (OS 1117) The request could not be performed because of an I/O device error.
Thu Feb 28 12:37:08 2013
Errors in file d:\app\collbrs\diag\rdbms\collbrs\collbrs\trace\collbrs_ckpt_3160.trc:
ORA-00202: control file: 'D:\APP\COLLBRS\ORADATA\COLLBRS\CONTROL01.CTL'
ORA-27070: async read/write failed
OSD-04006: ReadFile() failure, unable to read from file
O/S-Error: (OS 1117) The request could not be performed because of an I/O device error.
Thu Feb 28 12:37:28 2013
Errors in file d:\app\collbrs\diag\rdbms\collbrs\collbrs\trace\collbrs_ckpt_3160.trc:
ORA-00202: control file: 'D:\APP\COLLBRS\ORADATA\COLLBRS\CONTROL01.CTL'
ORA-27070: async read/write failed
OSD-04006: ReadFile() failure, unable to read from file
O/S-Error: (OS 1117) The request could not be performed because of an I/O device error.
Thu Feb 28 12:37:50 2013
Errors in file d:\app\collbrs\diag\rdbms\collbrs\collbrs\trace\collbrs_ckpt_3160.trc:
ORA-00202: control file: 'D:\APP\COLLBRS\ORADATA\COLLBRS\CONTROL01.CTL'
ORA-27070: async read/write failed
OSD-04006: ReadFile() failure, unable to read from file
O/S-Error: (OS 1117) The request could not be performed because of an I/O device error.
Thu Feb 28 12:38:07 2013
Errors in file d:\app\collbrs\diag\rdbms\collbrs\collbrs\trace\collbrs_m000_6256.trc:
ORA-00202: control file: 'D:\APP\COLLBRS\ORADATA\COLLBRS\CONTROL01.CTL'
ORA-27070: async read/write failed
OSD-04006: ReadFile() failure, unable to read from file
O/S-Error: (OS 1117) The request could not be performed because of an I/O device error.
Errors in file d:\app\collbrs\diag\rdbms\collbrs\collbrs\trace\collbrs_m000_6256.trc:
ORA-00204: error in reading (block 1, # blocks 1) of control file
ORA-00202: control file: 'D:\APP\COLLBRS\ORADATA\COLLBRS\CONTROL01.CTL'
ORA-27070: async read/write failed
OSD-04006: ReadFile() failure, unable to read from file
O/S-Error: (OS 1117) The request could not be performed because of an I/O device error.
Thu Feb 28 12:38:12 2013
Errors in file d:\app\collbrs\diag\rdbms\collbrs\collbrs\trace\collbrs_ckpt_3160.trc:
ORA-00202: control file: 'D:\APP\COLLBRS\ORADATA\COLLBRS\CONTROL01.CTL'
ORA-27070: async read/write failed
OSD-04006: ReadFile() failure, unable to read from file
O/S-Error: (OS 1117) The request could not be performed because of an I/O device error.
Thu Feb 28 12:38:34 2013
Errors in file d:\app\collbrs\diag\rdbms\collbrs\collbrs\trace\collbrs_ckpt_3160.trc:
ORA-00202: control file: 'D:\APP\COLLBRS\ORADATA\COLLBRS\CONTROL01.CTL'
ORA-27070: async read/write failed
OSD-04006: ReadFile() failure, unable to read from file
O/S-Error: (OS 1117) The request could not be performed because of an I/O device error.
Thu Feb 28 12:38:56 2013
Errors in file d:\app\collbrs\diag\rdbms\collbrs\collbrs\trace\collbrs_ckpt_3160.trc:
ORA-00202: control file: 'D:\APP\COLLBRS\ORADATA\COLLBRS\CONTROL01.CTL'
ORA-27070: async read/write failed
OSD-04006: ReadFile() failure, unable to read from file
O/S-Error: (OS 1117) The request could not be performed because of an I/O device error.
Thu Feb 28 12:39:31 2013
Errors in file d:\app\collbrs\diag\rdbms\collbrs\collbrs\trace\collbrs_ckpt_3160.trc:
ORA-00202: control file: 'D:\APP\COLLBRS\ORADATA\COLLBRS\CONTROL01.CTL'
ORA-27070: async read/write failed
OSD-04006: ReadFile() failure, unable to read from file
O/S-Error: (OS 1117) The request could not be performed because of an I/O device error.
Thu Feb 28 12:39:47 2013
Errors in file d:\app\collbrs\diag\rdbms\collbrs\collbrs\trace\collbrs_m001_7628.trc:
ORA-00202: control file: 'D:\APP\COLLBRS\ORADATA\COLLBRS\CONTROL01.CTL'
ORA-27070: async read/write failed
OSD-04006: ReadFile() failure, unable to read from file
O/S-Error: (OS 1117) The request could not be performed because of an I/O device error.
Thu Feb 28 12:39:49 2013
Errors in file d:\app\collbrs\diag\rdbms\collbrs\collbrs\trace\collbrs_ckpt_3160.trc:
ORA-00202: control file: 'D:\APP\COLLBRS\ORADATA\COLLBRS\CONTROL01.CTL'
ORA-27070: async read/write failed
OSD-04006: ReadFile() failure, unable to read from file
O/S-Error: (OS 1117) The request could not be performed because of an I/O device error.
Errors in file d:\app\collbrs\diag\rdbms\collbrs\collbrs\trace\collbrs_m001_7628.trc:
ORA-00204: error in reading (block 1, # blocks 1) of control file
ORA-00202: control file: 'D:\APP\COLLBRS\ORADATA\COLLBRS\CONTROL01.CTL'
ORA-27070: async read/write failed
OSD-04006: ReadFile() failure, unable to read from file
O/S-Error: (OS 1117) The request could not be performed because of an I/O device error.
Thu Feb 28 12:40:10 2013
Errors in file d:\app\collbrs\diag\rdbms\collbrs\collbrs\trace\collbrs_ckpt_3160.trc:
ORA-00202: control file: 'D:\APP\COLLBRS\ORADATA\COLLBRS\CONTROL01.CTL'
ORA-27070: async read/write failed
OSD-04006: ReadFile() failure, unable to read from file
O/S-Error: (OS 1117) The request could not be performed because of an I/O device error.
Thu Feb 28 12:40:31 2013
Errors in file d:\app\collbrs\diag\rdbms\collbrs\collbrs\trace\collbrs_ckpt_3160.trc:
ORA-00202: control file: 'D:\APP\COLLBRS\ORADATA\COLLBRS\CONTROL01.CTL'
ORA-27070: async read/write failed
OSD-04006: ReadFile() failure, unable to read from file
O/S-Error: (OS 1117) The request could not be performed because of an I/O device error.
Thu Feb 28 12:40:48 2013
Errors in file d:\app\collbrs\diag\rdbms\collbrs\collbrs\trace\collbrs_m002_2748.trc:
ORA-00202: control file: 'D:\APP\COLLBRS\ORADATA\COLLBRS\CONTROL01.CTL'
ORA-27070: async read/write failed
OSD-04006: ReadFile() failure, unable to read from file
O/S-Error: (OS 1117) The request could not be performed because of an I/O device error.
Errors in file d:\app\collbrs\diag\rdbms\collbrs\collbrs\trace\collbrs_m002_2748.trc:
ORA-00204: error in reading (block 1, # blocks 1) of control file
ORA-00202: control file: 'D:\APP\COLLBRS\ORADATA\COLLBRS\CONTROL01.CTL'
ORA-27070: async read/write failed
OSD-04006: ReadFile() failure, unable to read from file
O/S-Error: (OS 1117) The request could not be performed because of an I/O device error. -
Old DOS commands that prompt y/n
My organization assigns every employee a personal drive on a network share. For some reason, be it old software installs or bad workstation backups, many users now have a Windows directory on their network share that we'd like to get rid of. Easy to script,
right? I already did that:
$userfolders = gci \\server1\users\*\
$count1 = 0
foreach ($userfolder in $userfolders){
$windowsfolders = gci $userfolder.FullName -directory | where-object { $_.name -like "windows" }
foreach ($windowsfolder in $windowsfolders){
$fullname = $windowsfolder.fullname
remove-item $fullname -recurse -force
$count1++
write-host "$count1 Windows folders removed"
and it was successful on 90% of the user drives, but quite a few users have old IE temp files with more than enough characters in their name to be over 260 characters and Powershell won't remove those. CMD using rd /S will, but that prompts you "Are
you sure? Y/N"
So how do I pass a "y" to a CMD command in Powershell?
[email protected]For the record, passing old DOS commands in Powershell is a PITA. I ended up having to do this, because the "RD" command can't use a UNC:
$userfolders = gci \\pfil9903\users\*\
foreach ($userfolder in $userfolders){
$windowsfolders = gci $userfolder.FullName -directory | where-object { $_.name -like "windows" }
foreach ($windowsfolder in $windowsfolders){
$fullname = $windowsfolder.fullname
#remove-item $fullname -recurse -force
CMD /C "net use /delete z:"
CMD /C "net use z: $fullname"
CMD /C "rd /S /q z:\windows"
CMD /C "net use /delete z:"
But now I'm getting errors about z: still being in use:
CMD : The system cannot find the file specified.
At \\server\users\user1\Powershell\Users Windows Directory Removal.ps1:10 char:9
+ CMD /C "rd /S /q z:\windows"
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (The system cann...file specified.:String) [], RemoteException
+ FullyQualifiedErrorId : NativeCommandError
There are open files and/or incomplete directory searches pending on the connection to z:.
Any ideas?
[email protected] -
How to launch a DOS command with process
When I tried to create a process which launch a DOS command, I have a big exception with CreateProcess error=2.
I just would like to make a "cd directory"
Please help!!!Go back to the API documentation and look for the version of Runtime.exec() that allows you to specify the working directory. Even if you could run a task that executed "cd something" that would be pointless, since it would only change the current directory of that task.
-
Hi All,
anybody knows how to call a batch file from java
is there any DOS command aor dll file like url.dll by wich i can call my batch file from a java file
or may be some body can tell me how to use FileUploadProtocal to call a batch file from java
Please help me
ASAP
Thanks in advanceActuly I got these lines from a frnd
String loadPath = "rundll10 url.dll,FileProtocolHandler D:\\a.bat";
Process process = Runtime.getRuntime().exec(loadPath);
but my original code was
try{
boolean imported = true;
String _cmd = "cmd /c ";
cmd =cmd+"sqlldr ";
cmd = cmd + " userid=" + userId + "/" + passwd + "@"+ tnsEntry;
cmd = cmd + " control=" + controlFilePath;
cmd = cmd + " log=sql.log skip=1";
System.out.println(_cmd);
String envArr[] = new String[2];
envArr[0] = "ORACLE_HOME=" + System.getProperty("ORACLE_HOME");
envArr[1] = "PATH=" + System.getProperty("PATH");
try{
Runtime r = Runtime.getRuntime();
Process process = r.exec(_cmd);
catch(RuntimeException re )
System.out.println("Failed to runtime run the process.123.."+re);
it was not working even i m not getting any error or excep. so I tried that two lines above.
but still frustating results -
Execute DOS command inside java
I have a java program that reads each new user from an inputfile and writes that same user to an output file. The program works fine and is shown below:
import java.io.*;
public class FileStreamsTest {
public static void main(String[] args) {
try {
File inputFile = new File("newbousrs.txt");
File outputFile = new File("outagain.txt");
FileInputStream fis = new FileInputStream(inputFile);
FileOutputStream fos = new FileOutputStream(outputFile);
int c;
while ((c = fis.read()) != -1) {
fos.write(c);
fis.close();
fos.close();
} catch (FileNotFoundException e) {
System.err.println("FileStreamsTest: " + e);
} catch (IOException e) {
System.err.println("FileStreamsTest: " + e);
What I would like to do after each write is to execute a DOS command that looks something like this: supervsr.exe -USER username -PASS password -IMPORTUSERS importfile.txt
The DOS command above will add each user to the system I want to as the loop goes through each user record.
How do I execute the DOS command above inside java?Tried what but still having a problem...here is my code:
import java.io.*;
public class ReadSource {
public static void main(String[] arguments) {
try {
FileReader file = new FileReader("newbousrs.txt");
//FileWriter letters = new FileWriter("outagain.txt");
//PrintWriter pw = new PrintWriter(new FileWriter("outagain.txt"));
BufferedReader buff = new BufferedReader(file);
Runtime rt = Runtime.getRuntime();
boolean eof = false;
while (!eof) {
String line = buff.readLine();
if (line == null)
eof = true;
else
System.out.println(line);
Process proc = rt.exec("\\Blowfish\\droot\\Program Files\\Business Objects\\BusinessObjects 5.0\\supervsr.exe -USER xxxxx -PASS yyyy -IMPORTUSERS \\Blowfish\\droot\\accsp\\public\\newusers\\newbousrs.txt");
//System.out.println(line.substring(4, 10));
//System.out.println(line.substring(3,line.indexOf(',',3)));
buff.close();
} catch (IOException e) {
System.out.println("Error -- " + e.toString());
There error I get is this:
C:\jakarta-tomcat-4.0.3\webapps\webdav\WEB-INF\classes\accsp>java ReadSource
NU,Public,Steve Mcnealy,Steve Mcnealy,U,N,N,Y,N,N,PC,F,Y,N,N
Error -- java.io.IOException: CreateProcess: \Blowfish\droot\Program Files\Busin
ess Objects\BusinessObjects 5.0\supervsr.exe -USER accsp -PASS fish -IMPORTUSERS
\Blowfish\droot\accsp\public\newusers\newbousrs.txt error=3 -
Problem while running dos command from java program
Dear friends,
I need to terminate a running jar file from my java program which is running in the windows os.
For that i have an dos command to find process id of java program and kill by using tskill command.
Command to find process id is,
wmic /output:ProcessList.txt process where "name='java.exe'" get commandline,processid
This command gives the ProcessList.txt file and it contains the processid. I have to read this file to find the processid.
when i execute this command in dos prompt, it gives the processid in the ProcessList.txt file. But when i execute the same command in java program it keeps running mode only.
Code to run this command is,
public class KillProcess {
public static void main(String args[]) {
KillProcess kProcess = new KillProcess();
kProcess.getRunningProcess();
kProcess = new KillProcess();
kProcess.readProcessFile();
public void getRunningProcess() {
String cmd = "wmic /output:ProcessList.txt process where \"name='java.exe'\" get commandline,processid";
try {
Runtime run = Runtime.getRuntime();
Process process = run.exec(cmd);
int i = process.waitFor();
String s = null;
if(i==0) {
BufferedReader stdInput = new BufferedReader(new
InputStreamReader(process.getInputStream()));
while ((s = stdInput.readLine()) != null) {
System.out.println("--> "+s);
} else {
BufferedReader stdError = new BufferedReader(new
InputStreamReader(process.getErrorStream()));
while ((s = stdError.readLine()) != null) {
System.out.println("====> "+ s);
System.out.println("Running process End....");
} catch(Exception e) {
e.printStackTrace();
public String readProcessFile() {
System.out.println("Read Process File...");
File file = null;
FileInputStream fis = null;
BufferedReader br = null;
String pixieLoc = "";
try {
file = new File("ProcessList.txt");
if (file.exists() && file.length() > 0) {
fis = new FileInputStream(file);
br = new BufferedReader(new InputStreamReader(fis, "UTF-16"));
String line;
while((line = br.readLine()) != null) {
System.out.println(line);
} else {
System.out.println("No such file");
} catch (Exception e) {
e.printStackTrace();
return pixieLoc;
} when i remove the process.waitFor(), then while reading the ProcessList.txt file, it says "No such file".
if i give process.waitFor(), then it's in running mode and program is not completed.
Colud anyone please tell me how to handle this situation?
or Is there anyother way to kill the one running process in windows from java program?
Thanks in advance,
SathishHi masijade,
The modified code is,
class StreamGobbler extends Thread
InputStream is;
String type;
StreamGobbler(InputStream is, String type)
this.is = is;
this.type = type;
public void run()
try
InputStreamReader isr = new InputStreamReader(is, "UTF-16");
BufferedReader br = new BufferedReader(isr);
String line=null;
while ( (line = br.readLine()) != null)
System.out.println(type + ">" + line);
} catch (IOException ioe)
ioe.printStackTrace();
public class GoodWindowsExec
public static void main(String args[])
try
String osName = System.getProperty("os.name" );
String[] cmd = new String[3];
if( osName.equals( "Windows 95" ) )
cmd[0] = "command.com" ;
cmd[1] = "/C" ;
cmd[2] = "wmic process where \"name='java.exe'\" get commandline,processid";
} else {
cmd[0] = "cmd.exe" ;
cmd[1] = "/C" ;
cmd[2] = "wmic process where \"name='java.exe'\" get commandline,processid";
Runtime rt = Runtime.getRuntime();
System.out.println("Execing " + cmd[0] + " " + cmd[1]
+ " " + cmd[2]);
Process proc = rt.exec(cmd);
System.out.println("Executing.......");
// any error message?
StreamGobbler errorGobbler = new
StreamGobbler(proc.getErrorStream(), "ERROR");
// any output?
StreamGobbler outputGobbler = new
StreamGobbler(proc.getInputStream(), "OUTPUT");
// kick them off
errorGobbler.start();
outputGobbler.start();
// any error???
int exitVal = proc.waitFor();
System.out.println("ExitValue: " + exitVal);
} catch (Throwable t)
t.printStackTrace();
}when i execute the above code, i got output as,
Execing cmd.exe /C wmic process where "name='java.exe'" get commandline,processid
and keeps in running mode only.
If i execute the same command in dos prompt,
CommandLine
ProcessId
java -classpath ./../lib/StartApp.jar;./../lib; com.abc.middle.startapp.StartAPP 2468
If i modify the command as,
cmd.exe /C wmic process where "name='java.exe'" get commandline,processid > 123.txt
and keeps in running mode only.
If i open the file when program in running mode, no contents in that file.
If i terminte the program and if i open the file, then i find the processid in that file.
Can you help me to solve this issue? -
Execute dos commands in flex. Help !
I have the following dos command to start and stop screen recording from command prompt and it works flawlessly !!
vlc dshow:// :dshow-vdev="None" :input-slave=screen:// :screen-fps=10 --screen-width=640 --screen-height=480 --screen-top=144 --screen-left=192 :sout=#transcode{vcodec=WMV2,vb=1600,scale=1,acodec=wma2,ab=64,channels=1,samplerate=1102 5}:std{access=file,mux=asf,dst=c:/check_cj.wmv} --high-priority && vlc screen:// --one-instance -I dummy --dummy-quiet --extraintf rc --rc-host localhost:8088 --rc-quiet --screen-follow-mouse --no-video :screen-fps=15 :screen-caching=300 --sout=#transcode{vcodec=h264,vb=400,fps=5,scale=1,width=1024,height=768,acodec=none}:dup licate{dst=std{access=file,mux=mp4,dst=C:/capture_final.mp4}}
How can i run this from the air application. Can any one provide me the exact code ??? I tried it via native process but ended up with a error. Please help !have you tried running cmd.exe and adding that command as arguments to the native process running cmd.exe? That is the next thing I would try.
-
How to execute MS DOS command through Java program???
Dear Sir,
I want to run a MS-DOS command through my Java program. I have tried "Dir" command but no other command which takes command line args doesn't work at all. Please help.
import java.io.*;
class CommandPrompt
public static void main(String[] args)
try
File file = new File("C:/Temp/Java");
String[] cmd = {"command.com","/c","md folder"};
String[] envp = {""};
Process m;
String s = "";
m = Runtime.getRuntime().exec(cmd,null,file);
BufferedReader buf = new BufferedReader(new InputStreamReader(m.getInputStream()));
while ((s = buf.readLine())!=null)
System.out.println(s);
catch (Exception ex)
System.out.println("Exception is "+ex);
ex.printStackTrace();1. This forum is for Swing-related issues only. This question should be posted to the "Java Programming" forum.
2. Please enclose your sample code in code blocks; it's much easier to read that way. See here for how it's done: http://forum.java.sun.com/faq.jsp#messageformat
3. Please provide more information, like what error messages you got and what OS you're running. For instance, if you're running WinXP, Win2k or NT4, your command processor should be "cmd.exe", not "command.com". When I made that change, your program worked for me. -
I am trying to shell out a dos command and it doesn't work. I get no error message. The command is supposed to create a text file, and the file doesn't get created. Has anybody tried to do this?dos example:date /t > c:\test.txt
I think you need two >>'s, and no space between the >> and the filespec...<br><br>COPY r:\*.RUL x:\ >>flash_BATCH.LOG<br><br>HTH,<br><br>JM
-
Dos Command for pdf comparison
Hi,
I am using Adobe Acrobat Pro 9. I am using its(GUI) utility for pdfs comaparison. Now i want to comapre two pdfs using dos command. Do we have any dos command available for File comparision?
Thanks in advance
FatmiActuly I got these lines from a frnd
String loadPath = "rundll10 url.dll,FileProtocolHandler D:\\a.bat";
Process process = Runtime.getRuntime().exec(loadPath);
but my original code was
try{
boolean imported = true;
String _cmd = "cmd /c ";
cmd =cmd+"sqlldr ";
cmd = cmd + " userid=" + userId + "/" + passwd + "@"+ tnsEntry;
cmd = cmd + " control=" + controlFilePath;
cmd = cmd + " log=sql.log skip=1";
System.out.println(_cmd);
String envArr[] = new String[2];
envArr[0] = "ORACLE_HOME=" + System.getProperty("ORACLE_HOME");
envArr[1] = "PATH=" + System.getProperty("PATH");
try{
Runtime r = Runtime.getRuntime();
Process process = r.exec(_cmd);
catch(RuntimeException re )
System.out.println("Failed to runtime run the process.123.."+re);
it was not working even i m not getting any error or excep. so I tried that two lines above.
but still frustating results -
Hi, Isn't there a DOS command line symbol so that when javac returns all your syntax errors you can pause the screen before it blazes by your screen and you only catch the last few syntax errors. I thought it was javac whatever.java /p, but this doesn't work.
Thanks.......gemannYou might try
javac yourClass | more
but I seem to remember trying that without success. -
CFexecute, cfx_consolecommand dos/bat file error
Good day all. i have a really confussing problem... Let me
break it down
I have written an application that requires barcodes. My
Printer is a PPLB printer (not really important). So i create a
file on the server (This is about all that works fine).....
The printer is a network printer. so on the server i set up
the capture " net use LPT2
\\<machinename>\\<printersharename> /persistent:yes
(What the above does for those that do not know is set up a
vitual printer port so if you print to lpt2 it goes to the network
printer)
The command works perfectly..... Now the only thing i have to
do is send the file to the printer....
If im on the server and type "COPY /B c:\filetosend LPT2: "
note the Colon after LPT2 must be there it works perfectly.
But from anything else it doesnt..
What i have tried:
1) I tried running the command via cfexecute and
CFX_consolecommand which is available at
www.intrafoundation.com
that however does not work
2) Thinking i was smart i decided to write a bat file....
Easy. I wrote the file then used cfexecute and consolecommand to
run the file. With output enabled The error says "File Not Found"
This i have checked the file is there and LPT port is setup.
As i said if i type the command in command prompt it works
perfectly.
Now just to through another spanner in the works. if i run
the bat file from double clicking in windows or in command propt
type print.bat. (the name of the bat file i created) it works
perfectly..... Can someone explain this
So what i have determined is that:
1) When i type the command or run the bat file from command
prompt it works.
2) It does not work via cfexecute or commandconsole.
With some more testing If i leave the colon out after LPT2 it
says "0 Files Copied" so i think the colon is giving the problem...
Any help would be appreciated with this regard....
Another program maybe etc
RegardsShapeShift,
Are you running the batch file or the dos command while
logged in as the
same user ColdFusion service is configured to run under? If
ColdFusion
is running under the default "Local System" account, try
turning on the
"Allow service to interact with the desktop" checkbox on the
"Log On"
tab for the ColdFusion service, or set the service to log in
with an
account you know has permissions to the remote printer.
HTH,
Carl
ShapeShift wrote:
> Good day all. i have a really confussing problem... Let
me break it down
>
> I have written an application that requires barcodes. My
Printer is a PPLB
> printer (not really important). So i create a file on
the server (This is about
> all that works fine).....
>
> The printer is a network printer. so on the server i set
up the capture " net
> use LPT2 \\<machinename>\\<printersharename>
/persistent:yes
>
> (What the above does for those that do not know is set
up a vitual printer
> port so if you print to lpt2 it goes to the network
printer)
> The command works perfectly..... Now the only thing i
have to do is send the
> file to the printer....
>
> If im on the server and type "COPY /B c:\filetosend
LPT2: " note the Colon
> after LPT2 must be there it works perfectly.
> But from anything else it doesnt..
>
> What i have tried:
> 1) I tried running the command via cfexecute and
CFX_consolecommand which is
> available at
http://www.intrafoundation.com
that however does not work
>
> 2) Thinking i was smart i decided to write a bat
file.... Easy. I wrote the
> file then used cfexecute and consolecommand to run the
file. With output
> enabled The error says "File Not Found" This i have
checked the file is there
> and LPT port is setup.
>
> As i said if i type the command in command prompt it
works perfectly.
>
> Now just to through another spanner in the works. if i
run the bat file from
> double clicking in windows or in command propt type
print.bat. (the name of the
> bat file i created) it works perfectly..... Can someone
explain this
>
> So what i have determined is that:
> 1) When i type the command or run the bat file from
command prompt it works.
> 2) It does not work via cfexecute or commandconsole.
>
> With some more testing If i leave the colon out after
LPT2 it says "0 Files
> Copied" so i think the colon is giving the problem...
>
> Any help would be appreciated with this regard....
> Another program maybe etc
>
> Regards
>
>
>
Maybe you are looking for
-
How do i move files from one user to another user?
i transferred files, etc. from an ibook G4 to my new macpro. i had 3 users on the older ibook. when i try to open files as one of the users from the ibook on my macpro, it says i do not have permission to open the files. i am the administrator on bot
-
Not able to use multiple grid function in smartview
Hi, One of my client want to use multiple grid function in Hyperion smartview and he was using latest version of Hyperion smartview 11.1.2.5. But still that feature was not enabled in smart view. Our's is windows environment and essbase server versio
-
Check Box values not reflecting in the pageflow instace variable
Hello BEA Experts, I am binding a checkBox group to an instance variable of a Pageflow , it seems that the array inside the pageflow is null no matter what can you please let me know why. Is it possible to bind the checkbox group tag to an array in P
-
WET610N and streaming Netflix or Windows 7 Media Center
I am trying to find out if I can use the WET610N to stream Netflix, my Windows 7 Media Center and DirecTV VOD to my HDTV. Also, what is the best way to configure: 1) use the CD or 2) let the DirecTV HD DVR Hardware: Linksys Router, wireless PC with
-
Can i request supporting my currency?
Hi, i leave and work in Kazakhstan (KZ). Existing Creative Cloud member. I love BC's workflow and features. The only concern, i can't setup a proper currency (KZT) for my ecommerce website. Can someone please help? Thanks in advance. Alex.