command-line

How do I Send Email from the Command Line?

I would like to quickly send email from the command line. I realize there are probably a number of different ways to do this. I'm looking for a simple way to do this from a linux terminal (likely a bash shell but anything should do) and an alternative way to do this on Windows. I want to be able to whip up an email right on the comman...

How to loop through files matching wildcard in batch file

I have a set of base filenames, for each name 'f' there are exactly two files, 'f.in' and 'f.out'. I want to write a batch file (in Windows XP) which goes through all the filenames, for each one it should: Display the base name 'f' Perform an action on 'f.in' Perform another action on 'f.out' I don't have any way to list the set of ...

How do I increment a value in a textfile using the regular Windows command-line?

I'd like to keep a "compile-counter" for one of my projects. I figured a quick and dirty way to do this would be to keep a textfile with a plain number in it, and then simply call upon a small script to increment this each time I compile. How would I go about doing this using the the regular Windows command-line? I don't really feel li...

In Ruby, is it possible to concat arguments to a command line using backquotes ?

I would like to execute an OS command from my ruby script but I want to add an argument from a ruby variable. I know that's possible by using keyword system like that : #!/usr/bin/env ruby directory = '/home/paulgreg/' system 'ls ' + directory but is that possible by using the "backquotes or backticks syntax" ? (I mean by using that ...

Good resources for writing console style applications for Windows?

For certain programs nothing beats the command line. Unfortunately, I have never seen good documentation or examples on how to write console applications that go beyond "Hello World". I'm interested in making console apps like Vim or Emacs. Well not exactly like Vim or Emacs but one that takes over the entire command prompt while it is...

Can .NET check other running programs command line parameters?

We've got an interesting case where we are trying to determine how different instances of our app were launched. Is there any way for .NET to be able to query another running instance and get the command line parameters passed to that instance? I've not been able to find any way to do it in .NET so far, so I thought I'd check here to see...

Preventing Command Line Injection Attacks

We're currently building an application that executes a number of external tools. We often have to pass information entered into our system by users to these tools. Obviously, this is a big security nightmare waiting to happen. Unfortunately, we've not yet found any classes in the .NET Framework that execute command line programs whil...

What is the best .WTV conversion tool?

.WTV is the new DVR-MR format for recorded TV-shows in the Vista Media Center with TV Pack 2008 installed. Since there is a bug in that TV Pack, not allowing to see the current playback posision within the MSAS COM State integration service, the only way to 'fix' the commercial skipping addin, is to convert the .WTV file into a .DVR-MR,...

How do I specify "the word under the cursor" on VIM's commandline?

I want to write a command that specifies "the word under the cursor" in VIM. For instance, let's say I have the cursor on a word and I make it appear twice. For instance, if the word is "abc" and I want "abcabc" then I could type: :s/\(abc\)/\1\1/ But then I'd like to be able to move the cursor to "def" and use the same command to...

Adding command recall to a Unix command line application

I'm working on a command line application for Solaris, written in Java6. I'd like to be able to scroll through a history of previous commands using the up and down arrows like many Unix tools allow (shells, VIM command mode prompt, etc). Is there any standard way of achieving this, or do I have to roll my own? ...

Is there a simple way in Haskell to call a shell command in Windows without the command window popping up?

I wrote a Haskell program that runs backup processes periodically on a Windows machine use rsync. But everytime I run the rsync command, a command window opens up to the top of all the windows. I would like to get rid of this window. What is the simplest way to do this? ...

Windows version of the Unix touch command

I'm looking for a Windows port of the UNIX touch command. I don't want to install an entire MKS toolkit just for the one tool. Is there a native port available somewhere or a command in Windows that does the same thing and supports features like all files in a directory by wildcard? Specifically I'm after changing mtime, ctime and atime...

Open one of a series of files using a batch file

I have up to 4 files based on this structure (note the prefixes are dates) 0830filename.txt 0907filename.txt 0914filename.txt 0921filename.txt I want to open the the most recent one (0921filename.txt). how can i do this in a batch file? Thanks. ...

How do you list all processes on the command line in Windows?

Is there a command equivalent to 'ps' on Unix that can list all processes on a Windows machine? ...

What is the design pattern for processing command line arguments

If you are writing a program that is executable from the command line, you often want to offer the user several options or flags, along with possibly more than one argument. I have stumbled my way through this many times, but is there some sort of design pattern for looping through args and spinning off the appropriate functions? Consid...

Change windows hostname from command line

Is it possible to change the hostname in Windows 2003 from the command line with out-of-the-box tools? ...

How to embed command shell in Visual Studio

I would like to be able to embed a command line interpreter inside a dockable window in Visual Studio. Is there any nice way to do this? ...

Using the result of a command as an argument in bash?

To create a playlist for all of the music in a folder, I am using the following command in bash: ls > list.txt I would like to use the result of the pwd (print working directory) command for the name of the playlist. Something like: ls > ${pwd}.txt That doesn't work though - can anyone tell me what syntax I need to use to do somet...

How can you find and replace text in a file using the Windows command-line environment?

I am writing a batch file script using Windows command-line environment and want to change each occurrence of some text in a file (ex. "FOO") with another (ex. "BAR"). What is the simplest way to do that? Any built in functions? ...

Is it possible to embed and use a portable executable in a .net DLL?

The easiest way to think of my question is to think of a single, simple unix command (albeit, this is for windows) and I need progmatic access to run it. I have a single command-line based executable that performs some unit of work. I want to call that executable with the .net process library, as I can do with any other executable. Ho...