Batch file cd path (path includes %)


Joined
Feb 7, 2016
Messages
2
Reaction score
0
I have been informed that a bunch of folders on our network at work have a folder called Site Plan and one called SitePlan. I've been tasked with going through and consolidating them.

I wrote a batch file that searches the network for such instances. The batch file works well EXCEPT for the fact that someone created folders called 100% CD or some variation of that.

Is there something that can be done to allow the batch file to CD to a folder whose name includes a percent sign?

Here's my current t batch file.
Code:
@echo off
if '%1'=='loop1' goto loop1
for /D %%p in (*.*) do call %0 loop1 "%%p"
goto end
:loop1
cd %2
echo "%CD%"
if not exist "Site Plan" goto next
if not exist SitePlan goto next
echo "%CD%">>q:\test2016-02-10.txt
:next
call %0
cd ..
goto end
 
Ad

Advertisements


Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top