Ask Your Question
3

What is the method of incorporating a variable into a doskey command to retrieve the variable value after executing, rather than obtaining the current value?

asked 2022-06-09 11:00:00 +0000

pufferfish gravatar image

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
3

answered 2021-07-04 20:00:00 +0000

nofretete gravatar image

To incorporate a variable into a doskey command to retrieve the variable value after executing, you can use the percent sign (%) before and after the variable name. For example, to create a doskey command to retrieve the value of a variable named "foo," you can use the following command:

doskey getfoo=echo %foo%

When you run the "getfoo" command, it will execute the "echo" command with the value of "foo" at the time the command was created, not the current value of "foo." To get the current value of "foo," you will need to update the command with the new value of "foo."

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account. This space is reserved only for answers. If you would like to engage in a discussion, please instead post a comment under the question or an answer that you would like to discuss

Add Answer


Question Tools

Stats

Asked: 2022-06-09 11:00:00 +0000

Seen: 13 times

Last updated: Jul 04 '21