command-line

Windows Equivalent of System Configuration Directory

I am developing a CLI application in Ruby, and I'd like to allow configuration in Unix via the standard config file cascade of /etc/appnamerc, ~/.appnamerc. However, the application is also meant to be run in a Windows environment, and I'm unsure of where one would put a file like /etc/appnamerc (C:\windows\system32\etc\drivers does not ...

How can I use cURL (or any command line tool) to do an HTTP Post to Twitter, with OAuth authentication?

I wish to use a command-line application, like cURL, to do some test posts to my test twitter account. I also wish to do this with OAuth authentication. How I can do this? Assume I already have created an application, in Twitter, and received my keys and stuff. (Also, please make sure you specify which key to use, and where, in the com...

Passing command line arguments.

Okay I have updated my code a little, but I am still not exactly sure how to use the vector of command line arguments that I pass. I tried to set it up like the code I have below, but it wont compile. It gives me the error that it cannot find argc and argv: 1>c:\users\chris\documents\visual studio 2008\projects\cplusplustwo\cplusplustwo...

Efficient way to get your IP address in shell scripts

Context: On *nix systems, one may get the IP address of the machine in a shell script this way: ifconfig | grep 'inet' | grep -v '127.0.0.1' | cut -d: -f2 | awk '{print $1}' Or this way too: ifconfig | grep 'inet' | grep -v '127.0.0.1' | awk '{print $2}' | sed 's/addr://' Question: Would there be a more straightforward, still porta...

Rails - No "Mate" command for .gitignore - Using InstantRails?

Hey guys, This is my first time making an app with any kind of version control and the idea of it sounds awesome. I'm just getting started and using some tutorials to figure it out. I created my app.... rails example Then started up git..... git init and now I'd like to make an .gitignore file which most tutorials are using mat...

How do you hyperlink to Word 2007 help pages?

I want to hyperlink to a page within the Word 2007 Object Model Reference documentation, that ships with Word 2007. These are webpages that use the ms-help:// protocol that Firefox cannot understand. So I wanted to specify the ms-help:// path of the help page as a command line argument to the viewer, CLVIEW.EXE. C:\Program Files\Mic...

Fastest/One-liner way to conditionally remove multiple directories on Unix

What is the shortest way I can write: rm -rfv public/stylesheets public/images public/javascripts and make it conditional, with something like: if [ ! -d public/stylesheets ]; then rm -rfv public/stylesheets; fi ... Just discovered/found a use for command-line conditionals :) ...

Sort characters in a string in UNIX

I would like to sort the characters in a string. e.g. echo cba | sort-command abc Is there a command that will allow me to do this or will I have to write an awk script to iterate over the string and sort it? Thanks ...

Sending commands to stdin and sending end of transmit (Ctrl+D)

Hi All, I want to run the following code. The application that I'm calling expects commands like User-Name=albert next line, another command and so on, until you are done. If you were to enter this manually from command line, you would type command, press enter, type command press enter. Right at the end AFTER PRESSING ENTER after the...

How can I find the svn diff between working copy and arbitrary rev?

I'm trying to write a multi-file patch for an open-source project, but the master copy has changed since I started working. I need to get the SVN difference (just the files under version control) between my uncommitted version and the revision from which it was checked. Which SVN command can I use to find the difference? Edit: I'm sorry...

Multiple absolute paths in PHP exec()

I am trying to an execute a program in PHP on Windows with multiple arguments and absolute paths using a method like this: <?php $FLACPATH = str_replace(" ","\ ",realpath("../../encoders/flac.exe")); $LAMEPATH = realpath("../../encoders/lame.exe"); $FILEPATH = realpath("../../encoders/01.flac"); function my_exec($cmd, $input='') { ...

Run plugin updates outwith Eclipse UI

I'm trying to update the plugins for an Eclipse Galileo SR2 installation from the command line. Something similar to this command (which asks for a specific feature): java -jar org.eclipse.equinox.launcher_*.jar -application org.eclipse.update.core.standaloneUpdate -command update Does anyone know if a command exists using p2 or any ...

Killing a program if it displays a dialog box (devenv.com running under CruiseControl.net)

I have CruiseControl.net running Visual Studio (2005/2008 - using devenv.com) as we need to build deployment projects (.vdproj). At times, for various reasons devenv decides that even though it was run from the command line, using the devenv.com varient, it still wants to put up a dialog box. Now, as it's running under CruiseControl.ne...

Binary name in java program compiled by gcj

Is there any way, from within a Java program compiled by gcj, to find out the name of the executable the user ran to start the program? In C, argv[0] (from inside main) is the name, but in Java, the args array given to main contains only the arguments to the main class. When running with a normal java command line, that makes some sense...

Install Powershell script with WiX

Hi, I have a signed PowerShell script which I want to deploy to a target machine via a WiX installer. Is it possible to give the script the execution rights? Regards, forki EDIT - It seems I have to call Powershell with --Command Set-ExecutionPolicy RemoteSigned, but I can't get it working. I see the Powershell command window openi...

Detect whether stdin is a file or console using .Net

Possible Duplicate: How can I determine whether Console.Out has been redirected to a file? Is there a way of telling whether the stdin stream to a console app is coming from the console or from a file using .Net? I'm writing an app that should read from a file on the stdin if there is one but ideally shouldn't read from the s...

Pipe STDOUT/STDIN with two process and a web output stream in C#

I have two processes that I'd like to pipe together with C#, and then send the output of the second one directly to an HTTP output stream. In a command line, I can do this and it works perfectly (where "-" represents stdin/stdout): proc1 "file_to_input" - | proc2 - - My problem is connecting these two processes in C# and being able t...

How to pass variables as stdin into command line from PHP

I am trying to write a PHP script that uses the pdftk app to merge an XFDF with a PDF form and output the merged PDF to the user. According to the pdftk documentation, I can pass the form data in via stdin and have the PDF output to the stdout stream. The normal, file-not-stream way to use pdftk from the command line is: pdftk blankform...

Java 1.5 Command Line Password Masking

All, Our server is running Java 1.5 and I am having difficulty trying to mask user input from the command line. I am executing a jar file (java -jar my.jar) and am working through command line prompts via printlns. I cannot use Java Console. Thanks ...

[ODBC Driver Manager] Data source name not found and no default driver specified

I am trying to connect to list the servers on my network using osql.exe -L. Instead of a list of servers, however, I get the following error: [ODBC Driver Manager] Data source name not found and no default driver specified I'm not sure what's causing this problem - any pointers leading in the right direction will be helpful. Thanks so ...