Reputation: 69
I've looked everywhere for an answer to this. Basically I need to find a " "(a space) in batch.
So, what i'm doing is making a custom command import/export batch script. Here is what i start by doing:
echo Enter commands file name without the .bat
set/p "file=>"
Now, after that set/p... line, I want to test if the "file" string contains a space.
How I can achieve this without using a different coding language? I'm keeping this strictly batch.
Upvotes: 0
Views: 3088
Reputation: 6630
This works for me:
for /f "tokens=2" %%a in ("%file%") do Echo Contains Space
Which will only Echo Contains Space
if there is a whitespace in file
Upvotes: 2