How can I suppress the "Complete batch job (Y / N)" confirmation in PowerShell?

When I press Ctrl+ Cin PowerShell, I get:

Complete a batch job (Yes / No)?

Similar to https://superuser.com/questions/35698/how-to-supress-terminate-batch-job-yn-confirmation , with the exception of Windows PowerShell.

Does PowerShell provide more control over batch jobs than CMD?

+10
source share
2 answers

The behavior is not caused by PowerShell and cannot change it .

cmd.exe - Powershell cmd cmd.exe .

:

, Node.js , node.exe PATH:

-, node.exe , Ctrl+C, .

PS> node -e "while (true);"

, Ctrl+C - .

, :

PS> "@echo off'nnode -e '"while (true);'"" | Set-Content test.cmd
PS> ./test.cmd

, Ctrl+C Terminate batch job (Y/N)? . ( , cmd.exe.)

, gulp cmd:

, gulp CLI.

Windows, gulp CLI gulp.cmd - . " " ( ) npm -package, JS .

gulp gulp.cmd :

# Execute from a project folder that has 'gulp' installed as a dependency.
# If 'gulp' is installed *globally* 
# Note: CLI 'npx' requires npm version 5.2.0+
PS C:\some\NodeJs\project> npx where gulp

- :

C:\some\NodeJs\project\node_modules\.bin\gulp
C:\some\NodeJs\project\node_modules\.bin\gulp.cmd

, where.exe Unix- , ...\gulp; , cmd.exe/Powershell , ...\gulp.cmd - .
( , , @set/p dummy="Press a key" gulp.cmd, , , gulp .cmd.
, gulp.exe.)

Windows node_modules\.bin CLI CLI, , :

  • node_modules\.bin\<some-cli> - Unix ( shebang).
  • node_modules\.bin\<some-cli>.cmd - Windows.

:

npm , Windows PowerShell (*.ps1). npm, yarn . :

  • *.ps1 - PowerShell, , cmd.exe ( ).

  • PowerShell cmd.exe , Windows 10.

PowerShell *.ps1 , npm, *.ps1, *.cmd .

+4

ConEmu64.exe?
, PowerShell.exe .

. powershell, , "", , .

0

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


All Articles