command-line

Looping through string values from a windows command line bat file

I am trying to create a batch script for my Windows machine that loops through a list of (string/decimal) values and uses each value as a parameter inside the loop. Below is an example of a simple for loop I would like to use to display all the different version files (from my list) FOR ? in ('1.1','1.2','2.4','3.9') do echo V[value_fr...

What would the best way be to take a string from a text file and search and replace another string with the one from the text file?

What would the best way be to take a string from a text file and search and replace another string with the one from the text file? E.g c:\output.txt has abcd and c:\newfile.txt has Stack overflow is great. I would like to replace great with abcd. What would be the best approach to do this? ...

how to run 'color' command in NAnt script

I've just started using Nant for my builds and tests. I want to make it change the color (or background) of my command prompt text when it fails so its easily noticed. The command in command prompt on Windows is 'color 4' to change it to red and color 7 for back to white. How do I make this run in a build script, echo doesn't work, exe...

How to get a list of sub-folders and their files, ordered by folder-names

Can I use "dir" command-line to get a list of sub-folders and their files, ordered by folder-names, and not just file-names ? using dir /s/b/o:gn > f.txt I first get all sub-folders and only then all sub files, e.g.: d:\root0\root1\folderA d:\root0\root1\folderB d:\root0\root1\file00.txt d:\root0\root1\file01.txt d:\root0\ro...

What is the difference between building C++ Builder project from IDE and command line?

Hello, I have different behaviour of compiler, when building project from IDE and from command-line, which I can not explain. The detailed issue's description is rather big, but it's really simple. I have a C++ Builder project, which has a PAS-file included (IncludeUnits.pas). This pas-file has several units and inc-files listed. Th...

Using the argparse output to call functions.

Currently my code looks like this. It allows me to parse multiple parameters my program script gets. Is there a different way that is closer to 'best practices'? I haven't seen code actually using the output of argparse, only how to set it up. def useArguments(): x = 0 while x <= 5: if x == 0: ...

Command line Questions in R

I am building an user input interface in R. onload of the program, I would like like to ask the user what their preferences are according to a set of 6 fields. This will then be used as a comparison tool for the rest of the program. e.g., >ThisProgram >"Hello, on a scale of 1 to 10, how much would you say you rate the outdoors in y...

Command Line in Batch file?

I am making a batch file to automate mysql installation silently. When I type the following line in the command prompt everything works fine. "C:\Program Files\MySQL\MySQL Server 5.1\bin\mysqlinstanceconfig.exe" -i -q ServiceName="mydb" RootPassword="pos" ServerType=DEVELOPMENT DatabaseType=INNODB Port=3306 My question is: can I someh...

How to get default NIC Connection Name in command line or C#

IMPORTANT EDIT: Back again on this subject. As you said there should be no default NIC, I'm trying to understand if there is a way to detect all the NICs that are actually connected. Having the MAC address of my physical interface is there a programmatic way to get interface name/interface status/etc... For example, my XP machine: De...

Shell command works on command line but not in PHP exec

I have a command that when run direct on the command line works as expected. It runs for over 30 seconds and does not throw any errors. When the same command is called through a PHP script through the php function exec() (which is contained in a script called by a cron) it throws the following error: Maximum execution time of 30 seco...

Exchange two folder names in bash

Often I want to exchange two folders like this: $ mv a{,-alt-tmp} $ mv a{-alt,} $ mv a-alt{-tmp,} i.e. the folder "a" becomes "a-alt" and "a-alt" becomes "a". Is there some bash command to accomplish this? There should be a minimal time gap between the two changes. I could do something similar with $ mv a{,-old} && mv a{-new,} but...

How do I programatically create an NDepend project file?

To start, this may be a useful link: http://www.ndepend.com/NDependConsole.aspx As anyone who has used Visual NDepend may know, with NDepends you need to import project / solution files, and the corresponding output directories, namespaces, and assemblies are added to the NDepends project. The problem I have, is I have TONS of these pr...

Eclipse command line build fails building android project, gui works fine

When I run this command on my android project workspace: eclipsec.exe -noSplash -data "F:\Users\awalsh\workspace" -application org.eclipse.jdt.apt.core.aptBuild I get this error: An error has occured. See the logfile F:\Users\awalsh\workspace.metadata.log There are a bunch of eclipse related errors in the log and then some android re...

Are there any web browser plugins that can give access to machine's command line? (for local use)

EDIT: please read the question and why I want to do it before passing judgement on this, I want to develop locally using a web browser as the interface, I KNOW its a security hole, but if there is a way for the end user to disable this security so it can be used locally I want to know, of course this isn't possible under normal circumsta...

How can I test command-line applications using maven?

I work on a complex, multi-module maven project. One of the modules is an executable jar that implements a command-line application. I need to integration test this application. I need to run it several times, with several different command-lines and validate the exit status and stdout/err. However, I can't find a plugin for maven that c...

How to run script commands from variables?

I tried to run commands using pipes. Basic: single="ls -l" $single which works as expected Pipes: multi="ls -l | grep e" $multi ls: |: No such file or directory ls: grep: No such file or directory ls: e: No such file or directory ...no surprise bash < $multi $multi: ambiguous redirect next try bash $multi /bin/ls: /bin/ls: c...

How to remove scrollbars in console windows C++

I have been checking out some Rogue like games (Larn, Rogue, etc) that are written in C and C++, and I have noticed that they do not have the scrollbars to the right of the console window. How can I accomplish this same feature? ...

What's a decent SFTP command-line client for windows?

Most of the windows SFTP clients (like FileZilla) seem to be GUI-based. I need something I can call from batch files. ...

Java - communicating with a sub app through the input stream

Hi, Is there a way I can start a command-line application from java and then send strings (commands) to its input stream and display its response from its output stream? I'm using an application with a pretty sophisticated command line interface (vlc). The application has an interpreter that responds to a set of commands. For example...

Using a Single-String Regex While Doing In-Place Perl Editing

I'm using one-off perl -pi -e commands to do simple search and replace from within a bash script. Most of my regexes work fine, until I get to these: perl -pi -e 's#\<\?mso-application.*\<Table.*Rows="1"\>#\<Table\>#s' 1.xml perl -pi -e 's#\</Table.*#\</Table\>#s' 1.xml Please don't mind the # marks instead of slashes, I didn't want t...