Batch File Works - but - Does Not End

Discuss all aspects of programming here.

Moderator: The Mod Squad

Post Reply
User avatar
meppwc
Brown Belt
Brown Belt
Posts: 319
Joined: Fri Jan 24, 2003 11:59 am

Batch File Works - but - Does Not End

Post by meppwc »

The following batch file works correctly but once completed, I get a blinking underscore and I have to do CTRL-C to terminate it.
Am I missing something to make that work correctly.

cd\
cls
@echo on
del "C:\Users\wcmepp\desktop\XcopyList.txt"
xcopy "C:\Users\WCMEPP\Desktop\*.*" "z:\" /C/E/H/R/K/D/M/Y >"C:\Users\wcmepp\desktop\XcopyList.txt"
@echo on
Antec 900 - 650W ATX
Intel DQ35JOE
Intel Core 2 DUO Q6600 Quad Core 4gb
Kingston 8GB (4x2GB) PC2-6400 DDR2-800MHz Intel PC Desktop Memory DIMM SDRAM 240pin
Primary: SATA Kingston A400 SSD 240GB SATA 3 2.5” Solid State Drive SA400S37 (240gb)
Secondary: SATA 3gb/s - Hitachi HDP725050GLA360(500 gb)
External: USB: SATA 3gb/s - WDC-WD7500AACS-00ZJB0 (750 gb)
NVIDIA GeForce GTX 750 - PCIe v1.1 x16 (2.5 Gb/s) @ x16 (2.5 Gb/s)
MS Windows 10-64bit
BIOS: JOQ3510J.86A.1143.2010.1209.0048 - 12/09/2010
Roach412
Black Belt 2nd Degree
Black Belt 2nd Degree
Posts: 2760
Joined: Mon Aug 09, 2004 7:33 pm
Location: Milwaukee - Wisconsin

Re: Batch File Works - but - Does Not End

Post by Roach412 »

Code: Select all

ENDLOCAL
I believe EXIT will be a sledgehammer approach as well - typically, I've done my scripts something like below (this one just counts some files and if >5 reports that the process is stuck and pauses permanently until acknowledged.

Code: Select all

@ECHO OFF

SETLOCAL 
SETLOCAL ENABLEDELAYEDEXPANSION

SET count=0 
for %%o IN (\\xxxx\yyyyy\data\NBSCORS\*.*) DO ( 
      echo %%o 
      SET /A count=count + 1 
)

echo %count%

IF "%count%" GEQ "5" (
  start "" cmd /c "echo NewPrint is stuck... &echo(&pause"
  )

ENDLOCAL ENABLEDELAYEDEXPANSION 
ENDLOCAL
-R
Lian Li Lancool First Knight Series PC-K59W
Intel Core i7-960 Bloomfield 3.2GHz
EVGA X58 FTW3 132-GT-E768-TR
EVGA GeForce GTX 1070 FTW GAMING ACX 3.0
G.SKILL Ripjaws Series 12GB (3 x 4GB)
Crucial M4 128gb SATAIII SSD x2
Crucial M4 256gb SATAIII SSD
OCZ Saber 1000 960GB Enterprise SSD
Corsair Professional Series HX850 PSU
Dell UltraSharp U2713HM 27" w/drop ceiling mount
Logitech G930 7.1 Headset
DBPOWER RGB LED Keyboard
Logitech G402 Hyperion Fury
Post Reply