batch-file

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

Goto was unexpected at this time?

允我心安 提交于 2021-02-05 09:46:58
问题 I am trying to make a little connect four game and whenever I hit enter without typing anything into the console it says that goto was unexpected at this time All I want it to dos go back to :X for now if there is no user input. Any help would be aappreciated. :X cls echo -------------- echo Connect Four X echo -------------- echo. echo CHOOSE A COLUMN echo. echo. echo 1 2 3 4 5 6 7 echo. echo (%a6%) (%b6%) (%c6%) (%d6%) (%e6%) (%f6%) (%g6%) echo. echo (%a5%) (%b5%) (%c5%) (%d5%) (%e5%) (%f5%

VBscript to run a bat file with elevated privileges

我的梦境 提交于 2021-02-05 09:45:53
问题 Here is my bat file REG DELETE "HKLM\Software\Microsoft\Windows\CurrentVersion\WindowsUpdate" /v SusClientId /f REG DELETE "HKLM\Software\Microsoft\Windows\CurrentVersion\WindowsUpdate" /v SusClientIdValidation /f C:\Windows\System32\wuauclt.exe /resetauthorization /detectnow C:\Windows\System32\wuauclt.exe /reportnow The bat file doesn't work unless it's run inside an "Administrator Command Prompt" My question is how can I use a VBScript wrapper to run the bat file as an Admin? I was trying

Batch file get command's output stored in a variable

不羁岁月 提交于 2021-02-05 09:39:22
问题 i'm trying to store this WMIC output into a variable. when i echo VAL i get nothing ! all i'm trying to achieve is getting a file's last modification date. the problem with this WMIC command is that it returns a date as a long number and i want to manipulate that output this is the part of my script where i have this issue :: these lines are at the top of the script SETLOCAL ENABLEEXTENSIONS SETLOCAL ENABLEDELAYEDEXPANSION ... ... ... ... :: a function: set COMM="WMIC DataFile WHERE Name='C:\

How to run python program in background to keep active window the same

狂风中的少年 提交于 2021-02-05 08:00:09
问题 I have written a program that will change the foreground window to 85% of the monitor's dimensions and to run successfully the foreground window needs to remain the same. I have put the python script (.pyw) into a batch file (running pythonw) and created a shortcut to the batch file on the desktop with a shortcut to run it quickly. I also made it run the batch file minimized but it still switches the foreground window to the minimized command prompt. Per the python code below I am using