Reputation: 161
Using the caret to split lines,
dir ^
*.bat ^
/w
works as expected, but
dir ^
"*.bat" ^
won't let me enter the "/w". I guess the caret does not work after a double quote. Is this a bug? Or if this is a feature, what is it's use and how can I get around it?
Upvotes: 2
Views: 3962
Reputation: 41
An alternative solution that has worked for me (Windows Server 2012) is to include a tab on the subsequent line. For example:
dir ^
"*.bat" ^
/w
In my experience a tab character can replace a space when delimiting arguments to a command or script. I also feel that this has a cleaner look.
However, I haven't spent time testing it under every possible batch-file syntax scenario and it's possible there are some where it won't apply or work properly.
Upvotes: 4
Reputation: 161
I found the answer myself:
dir ^
^"*.bat^" ^
/w
works as I want. In the second line there must be spaces before the first caret and after the last. (using Vista SP2)
Upvotes: 6