Tags "cmd" Result

A more efficient way than: execlp(cmd[0], cmd[0], cmd[1] cmd[2], cmd[3] NULL);

i am trying to make a Command Line Iinterface program that can get line of code from user input and execute them using execlp. I wanna know if there is a better way of writing my code. execlp(cmd[0], cmd[0], cmd[1] cmd[2], cmd[3] NULL); perror("Execlp"); For example user enter 4 words and each of them will be store in: cmd[0] cmd[1] cmd[2] cm

it1352 0 2020-11-02

CMD Script: How to close the CMD

I have created a small command that will let me launch Internet Explorer. However, I wish to close the small command prompt that shows up when I launch IE. How can I do this? This is my current code: "%ProgramFiles%\Internet Explorer\iexplore.exe" http://localhost/test.html PAUSE I am guessing if I take out the Pause. It will close the CMD box u

it1352 0 2020-10-03

Run CMD Silently

I'm trying to run CMD silently, but each time I get an error. Could someone please tell me where I'm going wrong? Dim myProcess As Process myProcess.StartInfo.WindowStyle = ProcessWindowStyle.Hidden myProcess.StartInfo.CreateNoWindow = True myProcess.StartInfo.FileName = ("cmd.exe" & CmdStr) myProcess.Start() CmdStr is already a string

it1352 0 2020-07-07

Resize CMD Window

How can I resize the Command Prompt window programmatically in C or C ? For example 80x25 or 80x40 characters. Thank you in advance. Solution SetConsoleWindowInfo

it1352 0 2020-10-03

git CMD finds .gitconfig but Windows cmd does not?

When I run git config under git cmd, all is well. however when I run in in plain old Windows cmd, it can't find .gitconfig. I can't changes the env vars Home, Homedrive or Homepath since those are set by our corporate ad team. I'd like to know why git cmd works but git from windows cmd doesn't and what i can do about it. See screenshot: Scr

it1352 0 2020-10-08

Help with solving seemingly mutually exclusive problems please

I put everything in one file for ease of use; also I have #include <*.hfiles instead of the <*since my compiler is pre-ANSI C so it needs the .h #include <iostream.h> #include <iomanip.h> #include <string.h> class Cmd { public: virtual ~Cmd() {} char* printCmd() { return _name; } protected: Cmd() {} char _name[16]; }; cla

it1352 0 2019-07-04

Python eval doesn't work inside a function

Why does Python's eval not work inside a function? The same eval(compile(cmd)) code works in a global environment, but does not work inside the foo function. Simple example: fn = '/tmp/tmp' mode = 'single' def foo(cmd, fn, mode): eval(compile(cmd, fn, mode)) # <<< this does not work print 'foo: cmd=', cmd print 'foo: x=', x

it1352 0 2019-05-17

ElasticSearch in a runnable jar: lucene problems

I am trying to create a fat executable jar with maven, including elasticsearch as a dependency to create a TransportClient to a running elasticsearch node. From eclipse the client connects just fine to the node, but when I create a jar from the whole project and run that with java -jar bla.jar, the connection fails with: DEBUG - [Armor] adding add

it1352 5 2019-05-16

How to properly report an exit status in batch?

I'm facing a weird situation where a batch file I wrote reports an incorrect exit status. Here is a minimal sample that reproduces the problem: bug.cmd echo before if "" == "" ( echo first if exit /b 1 if "" == "" ( echo second if ) ) echo after If I run this script (using Python but the proble

it1352 4 2019-05-09

perror usage in this case

Can we check that my perror usage is correct? The background is these questions How to handle errors in execvp? How to use perror with dup2? and now I have this code which works but is the code correct? /* Helper function that forks pipes */ int fork_pipes (int n, struct command *cmd) { int i; int in, fd [2]; for (i = 0; i < n - 1;

it1352 2 2019-05-10