- 1 year ago
How can you define a bcdedit value from a variable by batch (tokens)?
Comment
1 / 1
To define a BCD (Boot Configuration Data) value from a variable using batch script and tokens, you can use the bcdedit
command in combination with variable expansion. Here's an example:
batch@echo off
set value=12345 67890
for /f "tokens=1,2" %%a in ("%value%") do (
bcdedit /set %%a %%b
)
In this example, the variable value
holds the value you want to set in the BCD. The value is separated by a space, and the for /f
loop with the "tokens" option is used to split the value into two tokens.
The for /f
loop iterates over the value and assigns each token to %%a
and %%b
. Inside the loop, the bcdedit /set
command is used to set the BCD value, where %%a
represents the first token, and %%b
represents the second token.
Adjust the code according to your specific BCD value format and use case.