Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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

1 Answer 1

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

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.