Questions tagged [command-execution]
19 questions
44
votes
7 answers
conditional execution (&& and ||) in powershell
There's already question addressing my issue (Can I get && to work in Powershell?), but with one difference. I need an OUTPUT from both commands. See, if I just run:
(command1 -arg1 -arg2) -and (command2 -arg1)
I won't see any output, but stderr…

Andy
- 3,139
- 4
- 21
- 13
7
votes
1 answer
Windows Batch: Executing command with FOR /F -- "command not found"
I have a problem with executing an other command within a FOR-command on Windows 7 Ultimate.
The for-command is part of a batch-file and should parse the outputs of another command.
Usually this:
for /f %%a IN ('tasklist') DO echo %%a
should…

Radon8472
- 4,285
- 1
- 33
- 41
7
votes
4 answers
Shell script: Execute command after running "exit" command in the shell script
I have a situation where in I have a command in my shell script that must be executed after a exit command is executed in the same script (I know!! It sounds crazy!!)
I want to find a solution for something like
#!/bin/sh
ls -l ~/.
exit $?
touch…

latestVersion
- 458
- 1
- 6
- 17
4
votes
7 answers
Is java Runtime.exec(String[]) platform independent?
I had some code that ran commands through Runtime.getRuntime.exec(String), and it worked on Windows. When I moved the code to Linux, it broke, and the only way of fixing it was to switch to the exec(String[]) version. If I leave things this way,…

Geo
- 93,257
- 117
- 344
- 520
3
votes
2 answers
C program executing command before being told to
I have started looking into command processing with C but I have hit a problem with this C program. It is executing the ls command before it is intended.
Gcc info:
gcc version 6.2.1 20161124 (Debian 6.2.1-5)
This is the code:
#include…

Bl4ckH4z3
- 33
- 4
2
votes
2 answers
How can I run a unix command without using a space character so that I can execute a remote command?
I've been learning about remote/arbitrary command execution. In doing so, I came across some Ruby I thought would be fun to try and exploit.
I've been somewhat successful as I managed to get it to run the 'ls' command, but I can't work out how to…

Chris
- 1,501
- 17
- 32
1
vote
1 answer
CommandExecuteIn Background throws a "Not an (encodable) value" error
I am currently trying to implement file exports in background so that the user can do some actions while the file is downloading.
I used the apache isis CommandExexuteIn:Background action attribute. However, I got an error
"Not an (encodable)…

Kesh
- 25
- 7
1
vote
1 answer
How do I get formatted value of environment variable
In my webapplication I want to allow administrators to execute system commands like:
Process proc = Runtime
.getRuntime()
.exec("cmd.exe /C dir C:\\\"Program Files…

My-Name-Is
- 4,814
- 10
- 44
- 84
0
votes
1 answer
Executing an interactive CLI program remotely
I wrote a small client/server application that can execute system commands remotely. It works fine with non interactive programs when you only need to read their output. However, is there a reliable way to send user input to the Process started IF…

Ree
- 6,061
- 11
- 48
- 50
0
votes
3 answers
What are the differences between Java's java.lang.Runtime.exec() and PHP's exec()?
The following doesn't work in Java (an exception is thrown):
Runtime.getRuntime().exec("cd mydir; myprog");
The same works fine in PHP:
exec("cd mydir; myprog");
What exactly is different in Java's implementation and why (it seems more limited at…

Ree
- 6,061
- 11
- 48
- 50
0
votes
1 answer
Test integrity of archive with 7-Zip in PowerShell
I am trying to test integrity of ZIP file
It looks like this command is working but I got many details about the file.
I want to get a result if the test passed or failed in order to move to the next step.
Any idea how to do it?
Something…

Bandit
- 399
- 3
- 10
0
votes
2 answers
Build is successful but I kept getting the 'Exception in thread "main" java.lang.StringIndexOutOfBoundsException: String index out of range: 1'
I have 3 classes but I think the problems are occurring between the Main and the Roman Numerals class. . . would also include the class Variables as well. . .
import java.util.Scanner;
public class Main{
public static void main (String[] args){
…
0
votes
1 answer
Command execution time in Java
Is there any way to know the execution time of the command? Making exec synchronous
Runtime rt = Runtime.getRuntime();
Process process = rt.exec(ffmpeg +" -i "+source+" -vcodec h264 -acodec aac "+destination);
the ffmpeg command is taking time so…

Danyal Sandeelo
- 12,196
- 10
- 47
- 78
0
votes
2 answers
Need help understing this short C++ program and its vulnerability
I would love if someone could explain me exactly what the code does. I know there's a buffer overflow and bash command execution vulnerability - but since I'm a network guy and not a programmer, I really could use some help to understand the entire…

Frisbee57
- 11
- 2
0
votes
1 answer
executing ADS related Powershell command through Java does not work giving 2 different errors when using 2 different ways
I have been trying to execute a set of commands in a powershell session through java, with no luck yet. My aim is to search a computer object in AD with the domain = "domain.com".
I started with a single command. Unfortunately, the following command…

Am_I_Helpful
- 18,735
- 7
- 49
- 73