START / B with php / node / python script does not work as expected

I run the shell and I run the following command:

START "" /B php test.php>nul 2>&1

For the purposes of this publication, test.php consists of 1 line: file_put_contents ("test", "test");

You expect it to instantly create a file called test, but that is not the case. Instead, when I enter a command and press enter, nothing happens. However, in the same command window, if I press the enter key again, the script will run.

I tried the equivalent command with node, python2 and python3. They all do the same thing, although python3 just requires 2 keystrokes before running the script.

This seems like a quirk when starting START / B with script interpreters. If I started START / B using .exe or .bat, then it will work as expected.

Now, obviously, I don’t need to start a background process that creates a file called "test". What I need is to start the daemon process written in php and the daemon process written in nodejs, one after another in the same terminal.

I also noticed that if I write these commands to a batch file and run them by double-clicking the batch file, instead of calling it from the shell, then everything will run as expected.

Please, help. I struggled with this problem for 2 days.

EDIT:

I just found that this problem is unique to my computer running Windows 10. I tried on Windows 7 and Windows XP and they did not require additional return inputs from me to run the script ...

. . , / Windows 10? , , ?

2:

script Windows 8, , Windows 10. SO : Windows 8 Windows 10 ... . FFFFFFFFFnnngggghhrrr... -, .

gif , :

enter image description here

, script .

+4
4

<NUL Enter .

start "" /b php test.php <NUL

Re: , , . ? ? ? * *

+1

start /b , Windows. ( do start /b "" prompt $G Return )

Windows (no /b - /min , ). Exit, :

start /min "" echo hello^>hello.txt^&Exit

: , >, &, |,..., "start" - , , .

0

. , cmd.exe .
cmd

test.php

<?php
echo "Hello";
?>

start "myTitle" /b php test.php
0

SO, .

Windows PHP "popen".
Wampserver, Windows 10 8.
.
- .

:
1. , '/wait' . 2. , PHP, PATH CMD. php.exe , Wampserver. . . .

0

Source: https://habr.com/ru/post/1618831/


All Articles