cmd.exe

Better windows command line shells

Is there a better windows command line shell other than cmd which has better copy paste between Windows' windows and console windows? ...

How to capture Python interpreter's and/or CMD.EXE's output from a Python script?

Is it possible to capture Python interpreter's output from a Python script? Is it possible to capture Windows CMD's output from a Python script? If so, which librar(y|ies) should I look into? ...

cmd defaults to F: drive

When I open cmd on my laptop it is defaulting to the F: drive. This is troubling me does anyone know how it got that way or how to get it back to where it opens to the C: drive by default? ...

Batch file to delete files older than N days

I am looking for a way to delete all files older than 7 days in an MS-DOS batch file. I've search around the web, and found some examples with hundreds of lines of code, and others that required installing extra command line utilities to accomplish the task. Similar things can be done in BASH in just a couple lines of code. It seems ...

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 can I open a cmd window in a specific location

Without having to navigate all the way to the directory I want. ...

How can I make a shortcut start in a different directory when running it as an administrator on Windows Vista?

I have a shortcut on my desktop which opens a command prompt with many arguments that I need. I set the 'start in' field to d:\ and it works as expected (the prompt starts in d:). When I choose Advanced -> run as administrator and then open the shortcut, it starts in C:\Windows\System32, even though I have not changed the 'start in' fi...

Is there any sed like utility for cmd.exe

I want to programmatically edit file content using windows command line (cmd.exe). In *nix there is sed for this tasks. Is there any usefull equivalent in windows? Edit: I am looking for native command line solution. ...

batch scripting iterating over files in a directory

How could I iterate over each file in a directory using for? And how could I tell if a certain entry is a directory or if it's just a file? ...

Windows default size for console application

While testing a console app, I set the properties of the console window to be only 3 lines high. This change has somehow stuck, meaning that new console windows default to 3 lines high. If I create a new shortcut on the desktop, and point it to cmd.exe, the window that opens is 3 lines high. Of course, I can alter this value using th...

Create a new cmd.exe window from within another cmd.exe prompt

I am in the process of setting up Cruise Control.NET. The problem I am having is that I am running CC as a console application and when my build completes successfully and executes (using exec) it launches it within the Cruise Control dos prompt. I am just using simple batch files to launch my app but having it run within the same prompt...

Why is the Windows cmd.exe limited to 80 characters wide?

I love stretching my terminal on unix. What is the history or reason behind windows lame command line? ...

How do I get the application exit code from a Windows command line?

I am running a program and want to see what its return code is (since it returns different codes based on different errors). I know in Bash I can do this by running echo $? What do I do when using cmd.exe on Windows? ...

DOS system path

Is there a way to programmatically, through a batch file (or powershell script), put all folders in c:\Program Files into the system variable PATH? I'm dependent on the command line and really want to just start a program from the command line. Yes, I'm jealous of Linux shells. ...

How to create a file without a Command Prompt window

I'm using WinRAR SFX module to create an installation, and use its presetup option to run some preliminary tests. Since wscript can only accept vbs file, and not the script itself, I first run "cmd /c echo {...script code...} > setup.vbs", and then I run "wscript setup.vbs". The run of the first cmd command opens a brief command window,...

Why is Vista64 using a 32bit cmd.exe by default? (machine-specific)

(I have this weird configuration problem at work, so I thought I'd give this site a try. My Google-Fu is failing me...) The situation: I need to convert our current development environment from XP 32bit to Vista 64bit (*). Naturally, I've run into plenty of places in our build system where hardcoded paths were problematic (e.g. "C:\Prog...

Scheduled Task: Directory cleanup using windows batch script

I have a shared disk that I would like to clean up once per week using a scheduled task of some sort. I would like to use a batch script so that the system admins can easily modify it or reuse it on other directories when needed. The directory has files with multiple file extensions but the ones that need to be deleted end in .bkf and m...

CMD.EXE batch script to display last 10 lines from a txt file.

Any ideas how to echo or type the last 10 lines of a txt file? I'm running a server change log script to prompt admins to state what they're doing, so we can track changes. I'm trying to get the script to show the last 10 entries or so to give an idea of what's been happening recently. I've found a script that deals with the last line, ...

How do I run a bat file in the background from another bat file?

I have a "setup" script which I run in the morning which starts all the programs that I need. Now some of those need additional setup of the environment, so I need to wrap them in small BAT scripts. How do I run such a script on Windows XP in the background? CALL env-script.bat runs it synchronously, i.e. the setup script can continue ...

programatically run cmd.exe as adminstrator in vista, c#

I have a visual studio setup and deployment project. I've added a .cmd script in it. The script would need administrator privilages to run. When user clicks on the setup.exe, UAC prompts the user for Admin permissions. So i assumed that all processes created and called within setup.exe will run in admin capacity. So i made the setup call...