When working with Bash, I can put the output of one command into another command like so:
my_command `echo Test`
would be the same thing as
my_command Test
(Obviously, this is just a non-practical example.)
I'm just wondering if you can do the same thing in Batch.
Represents a replaceable parameter. Use a single percent sign ( % ) to carry out the for command at the command prompt. Use double percent signs ( %% ) to carry out the for command within a batch file. Variables are case sensitive, and they must be represented with an alphabetical value such as %a, %b, or %c. ( <set> )
This means that your PATH is not defined correctly. Any NX command line application should be launched from a NX Command Prompt to ensure that the environment is set up correctly. Use Start, All Programs, Siemens NX##, Tools, Command Prompt to open a NX command prompt.
You can get a similar functionality using cmd.exe scripts with the for /f
command:
for /f "usebackq tokens=*" %%a in (`echo Test`) do my_command %%a
Yeah, it's kinda non-obvious (to say the least), but it's what's there.
See for /?
for the gory details.
Sidenote: I thought that to use "echo
" inside the backticks in a "for /f
" command would need to be done using "cmd.exe /c echo Test
" since echo
is an internal command to cmd.exe
, but it works in the more natural way. Windows batch scripts always surprise me somehow (but not usually in a good way).
You can do it by redirecting the output to a file first. For example:
echo zz > bla.txt set /p VV=<bla.txt echo %VV%
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With