cmd

DOS batch: SET variable and ECHO it within (…) block

跟風遠走 提交于 2021-02-06 09:14:48
问题 I had a problem with set not working in a batch file; it took a while to distil the problem; at first I thought it was to do with subroutine calls... The script @echo off setlocal set a=aaa echo a = "%a%" ( set b=bbb echo b = "%b%" ) produces the output a = "aaa" b = "" whereas I'd expect a = "aaa" b = "bbb" Why is this please? Is it a bug in DOS? Perhaps there's something about the (...) command grouping syntax that I'm unaware of. Thanks. 回答1: User delayed expansion and ! instead of % @echo

DOS batch: SET variable and ECHO it within (…) block

南笙酒味 提交于 2021-02-06 09:07:31
问题 I had a problem with set not working in a batch file; it took a while to distil the problem; at first I thought it was to do with subroutine calls... The script @echo off setlocal set a=aaa echo a = "%a%" ( set b=bbb echo b = "%b%" ) produces the output a = "aaa" b = "" whereas I'd expect a = "aaa" b = "bbb" Why is this please? Is it a bug in DOS? Perhaps there's something about the (...) command grouping syntax that I'm unaware of. Thanks. 回答1: User delayed expansion and ! instead of % @echo

DOS batch: SET variable and ECHO it within (…) block

眉间皱痕 提交于 2021-02-06 09:07:01
问题 I had a problem with set not working in a batch file; it took a while to distil the problem; at first I thought it was to do with subroutine calls... The script @echo off setlocal set a=aaa echo a = "%a%" ( set b=bbb echo b = "%b%" ) produces the output a = "aaa" b = "" whereas I'd expect a = "aaa" b = "bbb" Why is this please? Is it a bug in DOS? Perhaps there's something about the (...) command grouping syntax that I'm unaware of. Thanks. 回答1: User delayed expansion and ! instead of % @echo

DOS batch: SET variable and ECHO it within (…) block

邮差的信 提交于 2021-02-06 09:06:52
问题 I had a problem with set not working in a batch file; it took a while to distil the problem; at first I thought it was to do with subroutine calls... The script @echo off setlocal set a=aaa echo a = "%a%" ( set b=bbb echo b = "%b%" ) produces the output a = "aaa" b = "" whereas I'd expect a = "aaa" b = "bbb" Why is this please? Is it a bug in DOS? Perhaps there's something about the (...) command grouping syntax that I'm unaware of. Thanks. 回答1: User delayed expansion and ! instead of % @echo

How to get the window title of running application with command-line? [closed]

半城伤御伤魂 提交于 2021-02-06 06:30:54
问题 Closed . This question needs details or clarity. It is not currently accepting answers. Want to improve this question? Add details and clarify the problem by editing this post. Closed 2 years ago . Improve this question When application run in windows form it have property called window title . This window title appear in the tab of the application windows. I ask help to get this window title for the application running with command-line. 回答1: This is example how to get the windows title for

How to get the window title of running application with command-line? [closed]

人盡茶涼 提交于 2021-02-06 06:27:04
问题 Closed . This question needs details or clarity. It is not currently accepting answers. Want to improve this question? Add details and clarify the problem by editing this post. Closed 2 years ago . Improve this question When application run in windows form it have property called window title . This window title appear in the tab of the application windows. I ask help to get this window title for the application running with command-line. 回答1: This is example how to get the windows title for

How to pass a string to a Windows cmd that expects a file argument? [closed]

两盒软妹~` 提交于 2021-02-05 12:36:53
问题 Closed . This question needs details or clarity. It is not currently accepting answers. Want to improve this question? Add details and clarify the problem by editing this post. Closed 3 days ago . Improve this question Suppose a program cook takes one argument: the pathname of a text file containing the recipe of the food to cook. Suppose I wish to call this program from within a batch script, also suppose I already have the recipe in a string variable: set the_recipe = "wash cucumbers" "wash

How to pass a string to a Windows cmd that expects a file argument? [closed]

旧巷老猫 提交于 2021-02-05 12:36:39
问题 Closed . This question needs details or clarity. It is not currently accepting answers. Want to improve this question? Add details and clarify the problem by editing this post. Closed 3 days ago . Improve this question Suppose a program cook takes one argument: the pathname of a text file containing the recipe of the food to cook. Suppose I wish to call this program from within a batch script, also suppose I already have the recipe in a string variable: set the_recipe = "wash cucumbers" "wash

Using regex in Grep for Windows command line

柔情痞子 提交于 2021-02-05 10:10:22
问题 I want to capture all lines which contain exactly 3 fields, where a field is any string (possibly empty) followed by a | (and there may be some final text at the end of the line). I managed to build a regex which seems to do exactly what I want ^(?:[^\|]*\|){3}[^\|]*$ and when I try it on 101regex it seems to work just fine. However, I am having problems to run this regex on the Windows command line via grep and I guess it has something to do with the proper escaping. I tried grep -E '^^(?:[^

Using regex in Grep for Windows command line

梦想的初衷 提交于 2021-02-05 10:02:50
问题 I want to capture all lines which contain exactly 3 fields, where a field is any string (possibly empty) followed by a | (and there may be some final text at the end of the line). I managed to build a regex which seems to do exactly what I want ^(?:[^\|]*\|){3}[^\|]*$ and when I try it on 101regex it seems to work just fine. However, I am having problems to run this regex on the Windows command line via grep and I guess it has something to do with the proper escaping. I tried grep -E '^^(?:[^