4
I'm experienceing a problem with a batch file command - when I run the program, I have a "PAUSE" command at the end of the batch file, however, the command window still automatically closes instantly, too quickly for me to see the results. Is there another way to prevent the command window from closing, or to somehow get the results? i.e, can a printed version be sent, inserted somewhere?
Background - I know squat about command lines, so please, if you can, any response please dumb down to novice level explanations. I am ultimately trying to determine versions of a MS Project file, and have used/followed this website instructions exactly, however the results won't display for me - the command window just dissapears instantly:
Microsoft website I used for instructions: A simple method to determine the version of an mpp file (MS Project plan file)
The text/commands within the batch file:
@ECHO OFF
REM Version.bat
ECHO Filename: %1
ECHO.
ECHO -- CHECK FOR PROJECT VERSION --
strings %1 | findstr "[0-9],.,....,...." 2>NUL
ECHO Check the following list for the first one or two digits of the string above (xx,.,....,....)
ECHO List of xx (Product Name): 8 (98), 9 (2000), 10 (2002), 11 (2003), 12 (2007), 14 (2010)
ECHO.
ECHO -- CHECK FOR MPP FILE VERSION --
strings %1 | findstr ".MPP" 2>NUL
ECHO Check the following list for the digit(s) at the end of the string above (...MPPxx)
ECHO List of xx (Product Name): 8 (98), 9 (2000/2002/2003), 12 (2007), 14 (2010)
ECHO.
PAUSE
What OS are you using? I guess it is a flavor of windows but which one? – terdon – 2013-06-21T15:46:25.533
1I'm using windows XP - version 2002, service pack 3 – user232864 – 2013-06-21T15:48:12.297
Post your batch file contents – Travis – 2013-06-21T15:56:38.920
Here are the batch file contents, as described in the link (going to have to do this in 2 comment posts as it exceeds the max number of characters): @ECHO OFF REM Version.bat ECHO Filename: %1 ECHO. ECHO -- CHECK FOR PROJECT VERSION -- strings %1 | findstr "[0-9],.,....,...." 2>NUL ECHO Check the following list for the first one or two digits of the string above (xx,.,....,....) ECHO List of xx (Product Name): 8 (98), 9 (2000), 10 (2002), 11 – user232864 – 2013-06-21T16:00:50.087
(2003), 12 (2007), 14 (2010) ECHO. ECHO -- CHECK FOR MPP FILE VERSION -- strings %1 | findstr ".MPP" 2>NUL ECHO Check the following list for the digit(s) at the end of the string above (...MPPxx) ECHO List of xx (Product Name): 8 (98), 9 (2000/2002/2003), 12 (2007), 14 (2010) ECHO. PAUSE – user232864 – 2013-06-21T16:01:25.407
I’ll ask the “stupid question” –– are you sure that your batch file is running at all? Try adding a command line like
COPY NUL C:\TEMP\TESTFILE
(specifying a directory that exists, that you have write permission for, and a file that doesn’t exist) to your script (say, right before thePAUSE
), run it, and check whether the file was created. If it was, ignore this comment and focus on the other answers. If the file *wasn’t* created, try moving theCOPY
command to the beginning of the script. If it still doesn’t create the file: bad news; you’re not even running your batch file. – Scott – 2013-06-21T17:24:02.8601Scott - Thank you for the information above - all good to know. Turns out I didn't have the "strings" program installed, which was needed. Thanks for the assistance – user232864 – 2013-06-21T17:52:32.017