Our application runs a Windows batch file passing in a string argument. This string is derived from customer data, and so it can contain quotes, ampersands, percentages and so on.
What is the best way of escaping these special characters s the data gets passed into the batch file correctly?
For example, we may call a batchfile 'lookup.bat' that accepts a Product Code as an argument. We recently had trouble with product codes containing ampersands so we changed it from running 'lookup ABC&123" to 'lookup "ABC&123"' That works fine. However, product codes legitimately containing quotes now cause a problem.
Can anyone offer any advice? We need to be able to handle quotes,ampersands and spaces in the same string.
For reference, the contents of this batchfile do something akin to the following:-
run lookup-program :"%1":
This format is required due to the programming language involved