batch-file

Why are also *.tiff files output by Windows command DIR on searching for *.tif files?

こ雲淡風輕ζ 提交于 2021-02-05 07:45:47
问题 I want to use the Windows command DIR in order to find only TIF files, i.e. files with extension .tif . Therefore I use the following small batch file: for /f "delims=" %%a IN ('dir /b /a-d /s "C:\wolter\testversion-input\*.tif"') do echo %%a for /f "delims=" %%a IN ('dir /b /a-d /s "R:\wolter\testversion-input\*.tif"') do echo %%a Now I am wondering that this command also finds TIFF files, i.e. files with extension .tiff . So I made some tests and found out that the command DIR finds TIF AND

Why CMD escape character does magic instead of escaping new line

ⅰ亾dé卋堺 提交于 2021-02-05 06:32:09
问题 I try to execute simple script: set list="a",^ "b",^ c echo %list% And the output is "a","b",a","b",^ Although I expected it to be "a", "b", c. It seems that the quotation marks spoil everything because if b is without them, all works fine. It is also mysterious to me why it breaks only on second new line escape. So, why the output is so strange? I tried to launch the script on Windows 7 if it matters 回答1: Interesting question! It seems that when the ^ is placed at end of line, the first

cmd.exe equivalent of /dev/stdout, to write to stdout 'as a file'

时光毁灭记忆、已成空白 提交于 2021-02-05 06:31:42
问题 I have a batch file that calls a Windows GUI application. The GUI app writes it's output (the interesting bits anyway) to it's own GUI display rather than stdout, however I would like it displayed in the cmd window where the batch file is running. Thankfully the app has an option to write the output to a file, so I need to redirect this to stdout. In *nix I would give /dev/stdout as the file to write to but what about in Windows/cmd? 回答1: It seems that Windows has no equivalent to unix /dev

cmd.exe equivalent of /dev/stdout, to write to stdout 'as a file'

半城伤御伤魂 提交于 2021-02-05 06:31:38
问题 I have a batch file that calls a Windows GUI application. The GUI app writes it's output (the interesting bits anyway) to it's own GUI display rather than stdout, however I would like it displayed in the cmd window where the batch file is running. Thankfully the app has an option to write the output to a file, so I need to redirect this to stdout. In *nix I would give /dev/stdout as the file to write to but what about in Windows/cmd? 回答1: It seems that Windows has no equivalent to unix /dev

Why CMD escape character does magic instead of escaping new line

纵饮孤独 提交于 2021-02-05 06:31:13
问题 I try to execute simple script: set list="a",^ "b",^ c echo %list% And the output is "a","b",a","b",^ Although I expected it to be "a", "b", c. It seems that the quotation marks spoil everything because if b is without them, all works fine. It is also mysterious to me why it breaks only on second new line escape. So, why the output is so strange? I tried to launch the script on Windows 7 if it matters 回答1: Interesting question! It seems that when the ^ is placed at end of line, the first

Trim a line to just a string batchfile

我的梦境 提交于 2021-02-04 21:55:27
问题 I have over 2000 of these (similar) in a text file: 2018-07-07_11_38_MA_output_log.txt:[13:00:54] Accepted authentication token of user 76561198071607345 with global ban status 0 signed by Warsaw 1 server. 2018-07-07_11_38_MA_output_log.txt:[14:07:55] Accepted authentication token of user 76561198071607345 with global ban status 0 signed by Warsaw 1 server. 2018-07-07_11_38_MA_output_log.txt:[14:49:50] Accepted authentication token of user 76561198071607345 with global ban status 0 signed by

cmd: save wmic output to variable

断了今生、忘了曾经 提交于 2021-02-04 21:05:34
问题 I am trying to get the timestamp of a file into a variable in a batch file. My batch file, imagetime.bat contains the following: set targetfile=%~1 set targetfile=%targetfile:\=\\% echo %targetfile% for /f "usebackq delims=" %%i in ( `wmic datafile where name^="%targetfile%" get creationdate` ) do ( echo %%i ) echo %timestamp% And I get this output: C:\>imagetime.bat V:\setup.exe C:\>set targetfile=V:\setup.exe C:\>set targetfile=V:\\setup.exe C:\>echo V:\\setup.exe V:\\setup.exe C:\>for /F

cmd: save wmic output to variable

↘锁芯ラ 提交于 2021-02-04 21:05:30
问题 I am trying to get the timestamp of a file into a variable in a batch file. My batch file, imagetime.bat contains the following: set targetfile=%~1 set targetfile=%targetfile:\=\\% echo %targetfile% for /f "usebackq delims=" %%i in ( `wmic datafile where name^="%targetfile%" get creationdate` ) do ( echo %%i ) echo %timestamp% And I get this output: C:\>imagetime.bat V:\setup.exe C:\>set targetfile=V:\setup.exe C:\>set targetfile=V:\\setup.exe C:\>echo V:\\setup.exe V:\\setup.exe C:\>for /F

How to know which SSID I am connected in Windows batch file?

限于喜欢 提交于 2021-02-04 21:01:00
问题 For now, I have 2 batch file which turns on and off proxy using Registry Editor Like reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings" ^ /v ProxyEnable /t REG_DWORD /d 0 /f But, I read some where that it is possible to turn on or off proxy based on the network you are connected? So, if I can get the SSID name I can keep this in if else condtion 回答1: To simply get the SSID do: netsh wlan show interface | findstr /i "SSID" to set the first one as a variable use a for

How to know which SSID I am connected in Windows batch file?

你。 提交于 2021-02-04 21:00:45
问题 For now, I have 2 batch file which turns on and off proxy using Registry Editor Like reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings" ^ /v ProxyEnable /t REG_DWORD /d 0 /f But, I read some where that it is possible to turn on or off proxy based on the network you are connected? So, if I can get the SSID name I can keep this in if else condtion 回答1: To simply get the SSID do: netsh wlan show interface | findstr /i "SSID" to set the first one as a variable use a for