dos

How can I delete all files/subdirs except for some files in DOS?

I'm looking for a DOS script to delete all files and subdirectories in a root directory except for a set of batch files (*.bat) that are in the root directory. Any DOS jocks out there that know an easy way to do this? Update Thanks for your help everyone. This is where I'm at now (see below). I'm using Ken's suggestion for the delet...

How to stop batch script on del failure

We have a batch script that removes files (del) and directories (rd). Does anyone know how to halt (fail) execution of the script if any of these delete statements fail? They could fail if a file/directory is locked by Windows. Thanks. Update Statements I'm using: Del: del *.* /S /Q RD: FOR /D %%G in (*) DO RD /s /q %%G ...

DOS choice command on xp/NT

Is there a way to prompt users for input (ie: Yes/No) from a Dos batch script that works on XP and Windows 2003 server? It seems some commands (ie: choice) only work on one OS and not others. ...

Recursively search directories moving specified file type from one location to another preserving directory structure.

Is there some way to specify a directory (let's say "C:\images") and move every .jpg file from there to another directory (say "D:\media") but preserve the directory structure (so if the file were "C:\images\paintball\july\07\headshot.jpg" after moving it would be "D:\media\paintball\july\07\headshot.jpg")? I'm using cygwin (but would b...

How do I preserve variables in batch scripts when set in "for" loops?

I need to set my classpath using all of the jars in a particular directory. Bash does it as follows: CP_DELIMITER=; for j in "$MY_HOME/javalib/*.jar"; do if [ "$CP" ]; then CP="$CP$CP_DELIMITER$j" else CP="$j" fi done But "for" works differently in DOS, and essentially sends the command to the shell, but ...

LINUX equivalent of the DOS "start" command?

I'm writing a ksh script and I have to run a executable at a separate Command Prompt window. ...

Help required with ancient, unknown storage system.

Morning all, I've gone and told a customer I could migrate some of their old data out of a DOS based system into the new system I've developed for them. However I said that without actually looking at the files that stored the data in the old system - I just figured a quick google would solve all the problem for me... I was wrong! Anyw...

How do I pass arguments to shell script?

I have a batch file like this: java temptable %1 %2 I need the equivalent shell script for the above. I will pass the arguments to the shell script and that should be passed to temptable. ...

Interactive Batch File

How to proceed with an interactive batch file? Eg., DO you want to continue? [y/n] If 'y' Goto Label1 Else Goto Label2 Thanks ...

Convert Unix path to DOS path in a Korn shell script

I have a variable that stores a Unix path, for example: typeset unixpath=/foo/bar/ And I have to convert it to a DOS path using Korn shell scripting: dospath=\\foo\\bar\\ ...

How do I compile DOS programs on Debian?

For my assembly language class, we're writing DOS programs using DPMI. Unfortunately, I don't have access to a 32-bit windows machine all the time. I do have a Debian virtual machine installed on just about every computer I do use. I've got both DOSBox and DOSEMU installed. Is there any way that I can assemble and compile the program...

Not able to run SSIS PACKAGE by DOS commands

Hi... I want to run a SSIS package in command prompt... for that i used the command dtexec/f "C:/Filename.dtsx"...but when i executethis command i am getting an error like "Product level is insufficient for the component "Data Conversion"... but when i run the SSIS package in BIDS,it executed successfully... y is that?? is it because o...

What's causing xcopy to tell me Access Denied?

The postbuild task for one of our solutions uses xcopy to move files into a common directory for build artifacts. For some reason, on my computer (and on a VM I tested), the xcopy fails with "Access Denied". Here's what I've done to try and isolate the problems: I tried a normal copy; this works. I double-checked that none of the fil...

Can I mask an input text in a bat file

I am writing a batch file for execute some other programs. In this case I need to prompt for a password. Do I have any way to mask the input text. I don't need to print *** characters instead of input characters. Linux's Password prompt behaviour (Print nothing while typing) is enough. @echo off SET /P variable=Password : echo %vari...

Batch File input validation - Make sure user entered an integer

I'm experimenting with a DOS batch file to perform a simple operation which requires the user to enter a non-negative integer. I'm using simple batch-file techniques to get user input: @ECHO OFF SET /P UserInput=Please Enter a Number: The user can enter any text they want here, so I would like to add some routine to make sure what the...

Batch file variables initialized in a for loop

I have a batch file which initializes variables via SET inside a for loop, for a set of files on disk: for %%f in (%MYTARGETDIR%\*config.xml) do ( SET TMPFILE=%%F.tmp echo In loop %TMPFILE% ) echo End loop %TMPFILE% when I run this in a brand new command shell (without TMPFILE defined) the In loop echo is empty, but the end loop...

opening multiple pdf documents using batch file

Hello, I am trying to open several pdf documents using a simple batch file: ECHO OFF CLS cd Program Files\Adobe\Reader 9.0\Reader Acrord32.exe C:\Users\BW1.pdf Acrord32.exe C:\Users\BW2.pdf Acrord32.exe C:\Users\BW3.pdf Acrord32.exe C:\Users\BW4.pdf Acrord32.exe C:\Users\BW5.pdf Acrord32.exe C:\Users\BW6.pdf EXIT The above batch file...

How to make output filename equals to folder name

I have created a batch file to output a folder content into a list of names. @echo off cd /d %1 Title %~f1 dir %1 /b /l > %1\..\file_list.txt How can I make the file_list.txt to be "dir name".txt? For example I am at folder ABC and I want to output the dir list so that the final text file will be named ABC.txt instead of file_list.tx...

Running a stubborn executable in Dos Batch file...

I've got a pretty stubborn executable that I would like to execute sequentially multiple times from within a Dos batch file. (Due to IT constrains currently constrained to using Dos batch files.) I am able to use START to launch the executable, however, it seems the executable is expecting the user to hit return prior to "really" runni...

Passing a multi-line string as an argument to a script in Windows

I have a simple python script like so: import sys lines = sys.argv[1] for line in lines.splitlines(): print line I want to call it from the command line (or a .bat file) but the first argument may (and probably will) be a string with multiple lines in it. How does one do this? Of course, this works: import sys lines = """This...