Command Prompt commands
I know that while I use the command prompt in windows to execute java application, I cannot use the other windows commands such as
ipconfig,
telnet...
etc
Is there anyway where I can use the java commands (javac, java) AND the other regular commands??
The problem is happening because the PATH variable
settings is not proper.
Go to the environment variables in your machine and
append the following to the PATH environment
variable
%SystemRoot%\system32;%SystemRoot%;Save and then open a new command window and try.Yep, you were right.
I did that to the user's path and it worked after I appended it. It works for both now,
thanks.
Similar Messages
-
How to execute a Command Prompt command from J2SE code executing on Windows
How to execute a Command Prompt command from J2SE code executing on Windows??
Please help me[http://java.sun.com/docs/books/tutorial/getStarted/]
~ -
How to run a command prompt " command " through java code
hi all,
There is a command
"java -jar selenium-server.jar -interactive"
which i am running through command prompt after going to D:\MyFolder\Examples .
i want to execute this command using java code .please helpThis has already been answered in your other two threads on this topic - http://forum.java.sun.com/thread.jspa?threadID=5221221&messageID=9898287#9898287 and http://forum.java.sun.com/thread.jspa?threadID=5221223&messageID=9898290#9898290.
For some reason you don't want to read the reference that tells you exactly how to do what you want and how to avoid the pitfalls - http://www.javaworld.com/javaworld/jw-12-2000/jw-1229-traps.html . -
Runtime.exec() I need to run a command prompt command from java.
the code i have that doesn't seem to work is:
String driveloc = System.getProperty("user.dir").substring( 0, 1 );
String path = jTextFieldPath.getText();
String path2 = jTextFieldPath.getText().substring(0, jTextFieldPath.getText().length()-3) + "lst";
String[] cmd = { "cmd.exe", "/" + driveloc, "ASMtools\\AS11 " + path + " -L >" + path2};
txt_mf.append( cmd[3] );
try {
Process np = Runtime.getRuntime().exec( cmd );
catch( java.io.IOException ioe) {
//error
}jTextFieldPath.getText() contains the path of the file saved by my program.
the line of code i am trying to run is:
AS11 FILE1 -L FILE2this line compiles the asm file and converts it to a lst creating an s19 file in the process. AS11 is an exe that aids the command prompt much like javac.
If you could help me figure this out it would be great.
Thanks in advance,
-JukeString driveloc =
System.getProperty("user.dir").substring( 0, 1 );
String[] cmd = { "cmd.exe", "/" + driveloc,
"ASMtools\\AS11 " + path + " -L >" + path2};Are you sure you want to invoke cmd.exe with the switch /c or /d or whatever depending on System.getProperty("user.dir") ?
Starts a new instance of the Windows 2000 command interpreter
CMD [A | /U] [Q] [D] [E:ON | /E:OFF] [F:ON | /F:OFF] [V:ON | /V:OFF]
[[S] [C | /K] string]
/C Carries out the command specified by string and then terminates
/K Carries out the command specified by string but remains
/S Modifies the treatment of string after /C or /K (see below)
/Q Turns echo off
/D Disable execution of AutoRun commands from registry (see below)
/A Causes the output of internal commands to a pipe or file to be ANSI
/U Causes the output of internal commands to a pipe or file to be
Unicode
/T:fg Sets the foreground/background colors (see COLOR /? for more info)
/E:ON Enable command extensions (see below)
/E:OFF Disable command extensions (see below)
/F:ON Enable file and directory name completion characters (see below)
/F:OFF Disable file and directory name completion characters (see below)
/V:ON Enable delayed environment variable expansion using c as the
delimiter. For example, /V:ON would allow !var! to expand the
variable var at execution time. The var syntax expands variables
at input time, which is quite a different thing when inside of a FOR
loop.
/V:OFF Disable delayed environment expansion. -
Problem in executing command prompt commands through application
Hi,
I am facing issue in executing commands through VC++ application.
My application is a dialog based MFC application in VS2008.
I want to execute below commands programmatically.
devenv D:\TestApp\TestApp.sln /rebuild release
devenv D:\TestApp\TestApp.sln /rebuild debug
But I am not able to set the current directory path as "D:\TestApp\" programatically.
Through which API I can execute multiple commands on command prompt programmatically same as we do manually on cmd.
Please Help.
Thanks in Advance.
Thanks & Regards, Mayank AgarwalI want to execute below commands programmatically.
devenv D:\TestApp\TestApp.sln /rebuild release
devenv D:\TestApp\TestApp.sln /rebuild debug
But I am not able to set the current directory path as "D:\TestApp\" programatically.
Through which API I can execute multiple commands on command prompt programmatically same as we do manually on cmd.
Why can you "not able to set the current directory path as "D:\TestApp\" programatically"? Are you forgetting to escape the backslashes?
Why to you need to set the current directory anyway?
What is the problem with executing multiple commands?
As to your basic goal, have you looked at
system()
ShellExecute()
ShelExecuteEx()
CreateProcess()
? Perhaps you should show us what you have tried.
David Wilkinson | Visual C++ MVP -
This is a stoopid question and I've searched the forums, but what is the command in DOS prompt to view your classpath.
When I run java -classpath it gives me all the various options e.g.
java -cp -classpath
but non of these work? whats the craic?
M.What do you mean by "none of these work"?
Suppose that you have a file HelloWorld.class in the directory C:\MyClasses. If you type:
java -classpath C:\MyClasses HelloWorld
it should run your program without problems.
Are you getting an error message? What's the error message?
Jesper -
Running command prompt commands in java
I can use:
Process j = Runtime.getRuntime().exec("command";
BufferedReader stdInput = new BufferedReader(new InputStreamReader(j.getInputStream()));
BufferedReader stdError = new BufferedReader(new InputStreamReader(j.getErrorStream()));
to run commands in the command line buf if i make another process..the command will not run...any ideas?ProcessBuilder can simplify things:
redirectErrorStream
<quote>
If this property is true, then any error output generated by subprocesses subsequently started by this object's start() method will be merged with the standard output, so that both can be read using the Process.getInputStream() method. This makes it easier to correlate error messages with the corresponding output.
</quote> -
System 32 command prompt commands to factory reset hp notebook 2000 laptop
Need to factory reset notebook from command prompt
Normally tapping the F11 key immediately after powering on will boot into Recovery Manager.
******Clicking the Thumbs-Up button is a way to say -Thanks!.******
**Click Accept as Solution on a Reply that solves your issue to help others** -
Reading states of usb-6501 kit from command prompt?
Hi all!
I have been planning to use USB-6501 kit as one part of my test bench.
There will be need of checking state of some relays on
tested unit.
I would like to connect 6501 to those relays and read those
states using bare command prompt commands like readDigPort.exe
1. What software in need to install minimum to use writeDigPort.exe or readDigPort.exe commands at command prompt??
Those commands should be included in python script.
2. Is there such Linux commands also included somewhere in installation media/net ?
I am Using Fedora 3 ( Comedi not supporting 6501 ?)
3. I need only easy way to set and read values from 6501 ports which are my possibilities to do it?
Thank you!
Narsu ManHello,
Here are the answers:
1) You need NI-DAQmx Base driver for Linux. You may find the driver from web:
http://digital.ni.com/softlib.nsf/websearch/930D8687AD03A02C86256F8C00823BDB
Supported platforms and installation instructions can be found from here:
http://zone.ni.com/devzone/conceptd.nsf/webmain/42b73a7b82f0fec786256fb1007227ec
Please read the readme-file before installation.
2 & 3) LabVIEW and C-examples are shipped with the driver. C examples are installed by default to /usr/local/natinst/nidaqmxbase/examples. Use the example as a basic body for your application. NI-DAQmx Base Function reference help can be found from here:
http://digital.ni.com/manuals.nsf/websearch/D7184CB9E6366E2186256FBF0076BBC3
This should help you to continue.
Vesa K
National Instruments -
Command prompt to see remote connections
are there any command prompt commands to see which remote servers my apps are connected to? specifically database servers.
You can use:
netstat -ano (this command will show you all connections established, listening, etc.)
or
netstat -ano | findstr /C:"1433" (this command will show you all connections using 1433 port for example).
Daniel Lima -
Manipulating Windows command prompt through Java
I am wondering if there is any way to manipulate simple Windows command prompt commands like color, cd, dir, cls through a java application. Any help or informative redirection would be much appreciated.
BinaryBurnout wrote:
I am wondering if there is any way to manipulate simple Windows command prompt commands like color, cd, dir, cls through a java application. Any help or informative redirection would be much appreciated.Realize that the Windows command prompt is an application (cmd.exe), and those commands are specific to that application. -
Command prompt issue from VBscript
So I have this script that works perfectly for parsing out a COM number and then sending data to said COM port via the command line (things like 'ipconfig > //./COM15'). The issue is that it only works when I use the /K modifier which tells the command
windows to stay open. I don't want them to stay open, but whenever I remove the /K, it doesn't work. Nothing gets copied to the COM port. I suspect the cause of this is the command prompt closing before things like systeminfo can finish running. So is
there a way to have the command prompt window stay open for a short amount of time and then close?
'Part 1: FindCOM port
fileName = "C:\rtlstuff\COM.txt"
Set regex = New RegExp
regex.Pattern = "COM(\d+)"
regex.IgnoreCase = True
regex.Global = True
Set fso = CreateObject("Scripting.FileSystemObject")
Set file = fso.OpenTextFile(fileName)
text = file.ReadAll()
file.Close
Dim ComPort
Set matches = regex.Execute(text)
For Each m In matches
ComPort = m.SubMatches(0)
Next
'Part 2: Set file dictionary
set oDic = CreateObject("Scripting.Dictionary")
oDic.Add 0, "ECHO %DATE% %TIME% > //./COM"
oDic.Add 1, "ipconfig > //./COM"
oDic.Add 2, "systeminfo > //./COM"
v = 3
'Part 3: Set COM Variables
Set oShell = WScript.CreateObject ("WScript.Shell")
MODE = "MODE COM" & ComPort & " 9600,N,8,1,P"
oShell.run "cmd.exe /C" & MODE
'Part 4: Data transmission
Dim Command
x=0
do while x < v
Command = oDic.Item(x) & Comport
msgbox Command
oShell.run "cmd.exe " & Command
x=x+1
wscript.sleep 10000
loopCan you help me with syntax? I'm still not hugely familiar with VB and I'm not sure how to set this up. This current iteration does not work.
'Part 1: FindCOM port
fileName = "C:\rtlstuff\COM.txt"
Set regex = New RegExp
regex.Pattern = "COM(\d+)"
regex.IgnoreCase = True
regex.Global = True
Set fso = CreateObject("Scripting.FileSystemObject")
Set file = fso.OpenTextFile(fileName)
text = file.ReadAll()
file.Close
Dim ComPort
Set matches = regex.Execute(text)
For Each m In matches
ComPort = m.SubMatches(0)
Next
'Part 2: Set file dictionary
set oDic = CreateObject("Scripting.Dictionary")
oDic.Add 0, "ECHO %DATE% %TIME% > //./COM"
oDic.Add 1, "ipconfig > //./COM"
oDic.Add 2, "systeminfo > //./COM"
v = 3
'Part 3: Set COM Variables\par
Set oShell = WScript.CreateObject ("WScript.Shell")
MODE = "MODE COM" & ComPort & " 9600,N,8,1,P"
oShell.run "cmd.exe /C" & MODE
'Part 4: Data transmission
Dim Command
i = True
x=0
do while x < v
Command = oDic.Item(x) & Comport
msgbox Command
oShell.run "cmd.exe " & Command , ,True
x=x+1
wscript.sleep 10000
loop -
Query running on sql commands prompt not running on report region
Hi All,
Facing a weird issue now. I have written a report query which is running absolutely fine in sql command prompt but when i trying to run this as a report it is just processing and the report is not loading. What could be the reason behing this?
Thanks in Advance
RegardsHi,
With no other information about the problem is hard to know what's happening. If you could at least provide us with the query then I think it would be easier for us to help you.
Regards,
Sergio -
Unable to run discoverer report from command prompt
Hi,
I'm trying to run the discoverer report from command prompt and i need to schedule the same.
How could i pass multiple values for the parameters?
If i don't pass the optional parameters, the parameter screen is getting pop-up? How to skip optional parameters?
Also, how to pass the data ranges (format for date parameters) ?
I'm using the below command in command prompt:
cd/d E:\oracle\BIToolsHome_1\bin
dis51usr /connect username/password@database /opendb "TIMS-PCJ status Report" /sheet "TIMS observation status report (based on performed date)" /parameter "Test Number" 40351 /parameter "From Date" "01-JAN-2007" /parameter "To Date" "28-FEB-2007" /parameter "Observation Status" C /parameter "Observation Name" "Abdominal Girth" /export HTML "C:\DISCOVERER_REPORT_SCHEDULING\DIS_OUTPUT\PCJStatusOutput11"
Any one please reply me. Its very urgent.
Regards,
SreedharHi,
How could i pass multiple values for the parameters? You should be able to use a comma separated list e.g.
/parameter "Observation Name" "'Abdominal Girth','Abdominal Girth2'"
How to skip optional parameters?I don't think you can. You have to supply all parameters and then decode out the parameters you don't need in the workbook.
how to pass the data ranges You cannot pass a date range. You can pass a start and end parameters. The default format for the date parameters is DD-MON-YYYY but this can change depending on the NLS settings and format of the data item.
Rod West -
Technician computer is Windows 7 HP x64.
Running latest version of WAIK.
Goal: To make a Winpe disc for each processor architecture (AMD64, x86, IA64) with an included Gimage.exe using this code for the default startnet.cmd file found in system32 directory of winpe boot.wim
wpeinit
if /i %PROCESSOR_ARCHITECTURE%==amd64 (
cd x64
start gimagex.exe
if /i %PROCESSOR_ARCHITECTURE%==ia64 (
cd x64
start gimagex.exe
if /i %PROCESSOR_ARCHITECTURE%==x86 (
cd x86
start gimagex.exe
These are the commands I have processed for the x86 variant:
copype x86 c:\pe\x86\
Dism /mount-wim /wimfile:C:\pe\x86\winpe.wim /index:1 /mountdir:C:\mount
**It is at this point I copy over my x86 folder, x64 folder, and overwrite the startnet.cmd file.
dism /unmount-wim /mountdir:C:\mount /commit
oscdimg -n bc:\pe\x86\etfsboot.com c:\pe\x86\iso c:\pe\x86.iso
^^It is at this command I receive this error:
ERROR: Could not delete existing file "c:\pe\x86\iso"
Error 5: Access is denied.
Please note that all commands before were hand-typed, no copy or pasting from any directory or .chm
One thread referred to some Application Management service, but I can report that there is no such service installed in my machine.
Thank You!
UPDATE:
I copied the winpe.wim file from the x86 root directory into the iso directory and renamed it to boot.wim Now, if I copy the contents to a flash drive and put it into a client
computer, it boots to the PE perfectly, script and all.
However, when trying to use the oscdimg command, I do get an .iso successfully, but when I burn it, I don't know what to do in the way of boot options, and if I keep defaults (imgburn)
it results in an un-bootable dvd.
Suggestions are greatly appreciated.Don't copy and paste instead type manually it will work.
[email protected]
OMG! Yes, you are correct ... but I have no idea why! I retyped the command line:
oscdimg -n -be:\winpe_amd64\etfsboot.com e:\winpe_amd64\ISO e:\winpe_amd64\winpe_amd64.iso
into Notepad, and then pasted it into the Command Prompt, and it worked!
Perhaps there must be some hidden characters included when pasting directly, even though I first pasted the command line into Notepad, and then into Command Prompt
(C:\Program Files\Windows AIK\Tools\PETools>).
I had to retype the command line in Notepad before copying and pasting, before it would work.
Wow, thanks!
Cheers, Navy Flyer
Maybe you are looking for
-
HT3702 why are you charging me when i have not order any apps
Why are you charging me when i have not order any apps
-
Can iPod Classic Play Movies or Videos?
Hi... I have two iPod Classics (80GB & 160GB) and was wondering if they are capable of playing movies or videos? If not... Are any of the iPods capable of doing this? Thanks!
-
Do I pay for texting in imessage if the messages come up blue and I am on wi-fi?
Do I pay for imessaging if it is in blue and I am on wi-fi?
-
How do I connect ColdFusion Admin to MySQL
I have CF8 working now and I can render CF code but I am having trouble getting CF8 on my MacBook Pro to talk to a MySQL database. In the CF Administrator when I choose a datasource I choose a MySQL datbase name and select the MySQL driver 4/5 --- th
-
hi all; i saw this question in an old exam and i am not able to do it. plz HELP! 1 class X { 2 int f() { return 5 ; } 3 void g() { System.out.println( f() ) ; } 4 } Without changing class X or statement 6 below, write whatever necessary code such tha