for /F "delims=, tokens=1,2" %%x in ("%%a") do (
set "part1=%%x"
set "part2=%%y"
)
EDIT: Example added
@echo off
setlocal
for %%a in ("Parameter1,Parameter2") do (
echo Value of percent-percent-a: %%~a
for /F "delims=, tokens=1,2" %%x in ("%%~a") do (
set "part1=%%x"
set "part2=%%y"
)
)
echo Part1: "%part1%"
echo Part2: "%part2%"
Output:
Value of percent-percent-a: Parameter1,Parameter2
Part1: "Parameter1"
Part2: "Parameter2"
2nd EDIT
Excuse me; I apologize in advance for this edit, but I can't resist the temptation of post it...
When you post questions related to any programming language, but particularly in the case of Batch files, you should be very clear and describe the real problem you are trying to solve; otherwise the proposed solutions may work even worst than any other different code written with the complete specifications.
For example, if your question would be this instead: "I want to read a text file, ignoring lines that contain #, and get two comma delimited values into two separate variables", I would posted this solution:
@echo off
setlocal EnableDelayedExpansion
for /F "delims=, tokens=1,2" %%a in ('findstr /V "#" Text.txt') do (
set "param1=%%a"
set "param2=%%b"
echo Param1: !param1!
echo Param2: !param2!
echo/
)
Also, when you report "errors in a solution" you should be very careful that the errors you are reporting were not introduced by yourself; otherwise you are only bother the people that waste their time trying to provide you a solution for free! :(