PDA

View Full Version : Command prompt question


Actor
10-10-2015, 04:06 AM
I write my software to run in the Command Prompt. I've discovered that in passing parameters to a program on the command line you cannot pass a ^, <, > or a |. I can understand not being able to pass <, > or | since these are redirection operators and the OS interprets them as such, creating an error message. But ^ just gets ignored and the program still runs without error messages, albeit incorrectly. Why? What does the OS do with the ^?

This does not really affect me since I usually pass only file names like AQU1209.DRF and the problem does not arise. I only discovered this accidentally.

No big deal. Just curious.

Hoofless_Wonder
10-10-2015, 12:44 PM
Looks like the caret is reserved for continuation and escape:

http://www.pcmech.com/article/use-the-carat-to-escape-characters-in-the-command-prompt-and-batch-files/

wilderness
10-10-2015, 01:22 PM
I'm inclined to believe that alt-codes may work to replace what is referred to as 'special characters' (or reserved characters).
It's been so long since I've worked with batch files or extensive dos commands that I've simply forgotten.
A google ('batch files alt characters' provided links and/or explanations).

wilderness
10-10-2015, 02:10 PM
Here's a link for escaped characters in DOS (http://www.robvanderwoude.com/escapechars.php) with an explanation and chart

GameTheory
10-10-2015, 02:10 PM
I think you can send those things as strings to the program if you put them in quotes. (Just like path names with spaces.)

Dave Schwartz
10-10-2015, 05:07 PM
Many of my programs (including HSH) actually have a command line interface. I have never advertised it because (of course) it is not very user-friendly.

The command line interface is (basically) a very limited scripting language of my own creation. My point is, why not do that yourself?