Search found 2 matches

by User04
2022-Jan-23, 1:07 pm
Forum: Windows CMD Shell
Topic: Is it possible to use variables in a substring operation?
Replies: 2
Views: 3899

Re: Is it possible to use variables in a substring operation?

It's also possible to achieve the same result without delayed expansion. Since ECHO is an internal command, the following works: set String=1234567890 set /p x=Number of desired characters? call echo %%String:~0,%x%%% See also: The " Advanced Usage of :~ " section in How-to: Extract part o...
by User04
2022-Jan-23, 12:36 pm
Forum: Windows CMD Shell
Topic: CMD Prompt: Copying to Clipboard Adds Trailing Space
Replies: 1
Views: 2262

CMD Prompt: Copying to Clipboard Adds Trailing Space

I've noticed that, at the cmd prompt, when piping to the clipboard a trailing space is added to each line. Compare the following two commands typed at the cmd prompt: (for %a in (red green blue) do @(echo %a)) > tmp & notepad tmp (for %a in (red green blue) do @(echo %a)) | clip The first create...