What's the outcome of
Code: Select all
@echo off
set "ext=.html"
for /f "tokens=1* delims==" %%i in ('assoc "%ext%" 2^>nul') do (
for /f "tokens=1* delims==" %%k in ('ftype "%%j"') do echo %%l
)
pause
Moderator: DosItHelp
Code: Select all
@echo off
set "ext=.html"
for /f "tokens=1* delims==" %%i in ('assoc "%ext%" 2^>nul') do (
for /f "tokens=1* delims==" %%k in ('ftype "%%j"') do echo %%l
)
pause
Code: Select all
"C:\Program Files\Internet Explorer\iexplore.exe" %1
The behaviour should be similar on all windows systems, maybe slightly different on different versions/editions.misol101 wrote:At the top of this page(page 2) I write about some odd behaviour that is caused by running start /b with a very simple example file called banana.bat. Does it behave the same way for you?
Code: Select all
@echo off
pause
:LOOP
echo Banana %~1
goto LOOP
Code: Select all
Z:\>start /b "" bananas.bat 1
Z:\>Drücken Sie eine beliebige Taste . . . start /b "" bananas.bat 2
Z:\>Drücken Sie eine beliebige Taste . . .
Z:\>
Z:\>
banana 1
...
banana 1
Code: Select all
Z:\>start /b "" bananas.bat 1
Z:\>Drücken Sie eine beliebige Taste . . . start /b "" bananas.bat 2
Z:\>Drücken Sie eine beliebige Taste . . .
Z:\>
Z:\>
Z:\>
banana 2
...
banana 2
Code: Select all
...
Banana 1
Banana 2
Banana 1
Banana 2
Banana 1
Banana 2
Banana 1
Banana 2
...
penpen wrote:The command shell initially consists of the (main) process "Console Window Host" and one working thread ("Windows Command Processor"; lets name this thread T1).
With "start /B "" banana.bat " you create another thread (=: T2).
When you press CTRL+BREAK then the batch is breaked, with a message, but also the task is switched - so you type into the command shell wheere N/Y is no knwon command switching again to T1, ...
misol101 wrote:At the top of this page(page 2) I write about some odd behaviour that is caused by running start /b with a very simple example file called banana.bat. Does it behave the same way for you?
misol101 wrote:start /B "" "banana.bat"
As expected from the "start" documentation, Ctrl-C does not work to break. I press Ctrl-Break, the program stops and asks if I want to break. I press 'y', the shell says there is no command y, then "quits". Any command after this gives me back the question if I want to break the program, i.e. the cmd shell is all messed up...
Code: Select all
@echo off
(
echo @echo off
echo :LOOP
echo echo Banana
echo goto LOOP
)>banana.bat
start /B "" "banana.bat"
misol101 wrote:It should also be noted that if Chrome is *already running* when launching e.g. a html file, then there is no blocking. The problem happens only if Chrome is not running before.
foxidrive wrote:I wasn't able to follow up for some time but No, it doesn't behave like that here.
I assume you are starting the above batch by doubleclick on the icon (or similar).foxidrive wrote:I wasn't able to follow up for some time but No, it doesn't behave like that here.
Here is my test script:Code: Select all
@echo off
(
echo @echo off
echo :LOOP
echo echo Banana
echo goto LOOP
)>banana.bat
start /B "" "banana.bat"
penpen wrote:I assume you are starting the above batch by doubleclick on the icon (or similar).
In that case the console has no primary working thread that handles command line input, because it processes the above batch, resulting in capture of CTRL+BREAK from within that batch context.
To see the messed up console, you have to start cmd.exe first, and enter the line "start /b "" "banana.bat"" manually.
(Alternatively my "bananas.bat" example.)
foxidrive wrote:I giggled when testing it because only super-nerds or no-hopers would type a start command like that at the cmd prompt.
It's rare for me to use a cmd prompt for any serious work, I only open one for testing. Total commander puts everything at my fingertips and it gives me my favourite text editor on cue too.
You could provoke that error in various ways; the above method is only the simplest.foxidrive wrote:You're right penpen. I press enter in total commander to launch the script and doing as you outlined does cause issues. But I giggled when testing it because only super-nerds or no-hopers would type a start command like that at the cmd prompt.
Code: Select all
@echo off
start /B "" "banana.bat"
Code: Select all
@echo off
cmd /K "startBanana.bat"
penpen wrote:If you use the "banana.bat" from misol101, and the following scripts, then you should provoke the issue by just executing "test.bat" (in any way).