Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm trying to get a simple batch file to work.

set locDir="C:\Users\jp2code\My Projects\VS\Live\Mainframe\DataFactory\AppServerLib\"
notepad.exe locDir+readMe.txt
ECHO Complete!

When I run the test.bat batch file, I get a MessageBox from Notepad that says, "Cannot find the locDir+readMe.txt file."

It has been too long since I worked with DOS style batch processes.

Could someone refresh me on how to do this?

If this info is out on the internet, I can't seem to find it.

share|improve this question
up vote 1 down vote accepted
set locDir=C:\Users\jp2code\My Projects\VS\Live\Mainframe\DataFactory\AppServerLib\
notepad.exe %locDir%readMe.txt
ECHO Complete!
  • You have to use % symbols with variables
  • The + symbol isn't there for concatenating
  • If you use double quotes, you have to remove them afterwards. In my quick example I replaced them.
share|improve this answer
    
Quotes are wrong, but that did it. Thanks! – jp2code Feb 11 '13 at 16:35
    
This example won't work if your path contains & symbols. Its always a mess with them. – nixda Feb 11 '13 at 16:36
    
Got it. This is just to help me do some local file manipulation, so I promise not to use the Ampersand (&). – jp2code Feb 11 '13 at 16:39
    
Finish this sentence: This answer has had more edits than a ... – jp2code Feb 11 '13 at 16:53

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .