Batch file behavior

G

Guest

I can open the command window from the start menu, type in the commands and
it works fine, gives me the confirmation that the file was copied and stays
open until I close it. wrote a simple batch file to copy a file. when i run
it from a batch file the command window opens and closes so fast you almost
cannot see it, but it does copy. My goal: a batch file that opens the
command window, runs the script, displays success or failure messages, and
stays open until it is closed manually. follow up query; must you use 8.3
naming for files referenced in batch files?

Thanks for any help
S.Low
 
J

JCO

Hard to remember the DOS world but what about adding the "pause" command at
the location where you want it to stop. Then you can hit any key (or enter)
to continue the batch file.... which will close it.

echo.
echo.
echo. Job Successful!!
echo. Press "Enter" to Close
pause
:end
 
S

Shenan Stanley

SLow said:
I can open the command window from the start menu, type in the
commands and it works fine, gives me the confirmation that the file
was copied and stays open until I close it. wrote a simple batch
file to copy a file. when i run it from a batch file the command
window opens and closes so fast you almost cannot see it, but it
does copy. My goal: a batch file that opens the command window,
runs the script, displays success or failure messages, and stays
open until it is closed manually. follow up query; must you use 8.3
naming for files referenced in batch files?

Start your copy command with "cmd /k"//

cmd /k copy c:\dir1\*.* c:\dir2 /y

You might even look into the "start" command some (start /?).

And if you want to use long filenames, use Quotes..

cmd /k copy "c:\documents and settings\profile directory\my documents\*.*"
"d:\backup of my stuff\" /y

You also should look into "RoboCopy", "XXCopy" and just plain "XCOPY".
 
P

Pegasus \(MVP\)

SLow said:
I can open the command window from the start menu, type in the commands and
it works fine, gives me the confirmation that the file was copied and stays
open until I close it. wrote a simple batch file to copy a file. when i run
it from a batch file the command window opens and closes so fast you almost
cannot see it, but it does copy. My goal: a batch file that opens the
command window, runs the script, displays success or failure messages, and
stays open until it is closed manually. follow up query; must you use 8.3
naming for files referenced in batch files?

Thanks for any help
S.Low

Batch files that run under WinXP can use long file names.
There is no need to stick to the 8.3 convention.
 
G

GTS

Place a pause statement at the end of the batch file. It will display a
press a key to continue message and wait for a keypress to close. It is
not necessary to use 8.3 names. If file path/names have any spaces enclose
in quotes.
 
R

Robert Bollinger

The easiest way to do this; is to add the pause command at the end of the
batch file.

This is one of a dozen ways to do what you want

Robert Bollinger, MCP.
 
G

Guest

SLow said:
I can open the command window from the start menu, type in the commands and
it works fine, gives me the confirmation that the file was copied and stays
open until I close it. wrote a simple batch file to copy a file. when i run
it from a batch file the command window opens and closes so fast you almost
cannot see it, but it does copy. My goal: a batch file that opens the
command window, runs the script, displays success or failure messages, and
stays open until it is closed manually. follow up query; must you use 8.3
naming for files referenced in batch files?

Thanks for any help
S.Low
 
J

JCO

An update to my previous post :

****** your previous code is here ********
****** add 4-lines below *******
@echo off
echo. Job Successful!!
pause
:end
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top