Perché PowerShell riconosce "job" come un comando
Nella mia sessione di Powershell, la parola jobviene riconosciuta come "azione invocabile":
PS C:\Users\Rene\> job
Id Name PSJobTypeName State HasMoreData Location Command
-- ---- ------------- ----- ----------- -------- -------
1 Job1 BackgroundJob Completed True localhost ...
3 Job3 BackgroundJob Completed True localhost ...
5 Job5 BackgroundJob Completed True localhost ...
7 Job7 BackgroundJob Completed True localhost ...
9 Job9 BackgroundJob Completed True localhost ...
L'output di jobè lo stesso di get-job. Quindi, ho pensato che jobfosse una funzione o un alias o un cmdLet. Tuttavia, questo non sembra essere il caso:
PS C:\Users\Rene> get-command job
get-command : The term 'job' is not recognized as the name of a cmdlet, function,
script file, or operable program. Check the spelling of the name, or if a path
was included, verify that the path is correct and try again.
Quindi, se jobnon è né un cmdlet né una funzione, né un alias, né un file di script, che cos'è?
Risposte
hai scoperto come PoSh decide cosa intendi eseguire. [ sorride ] per quello che succede, ecco cosa mi è stato detto o ho visto.
quando inserisci un comando, PoSh cerca ...
- il comando esatto che hai inserito
- per il comando esatto nell'elenco dei percorsi del sistema operativo
- il comando con il
Get-prefisso
quella sequenza corrisponde a ciò che ricordo di ciò che ho letto o sperimentato, ma potrei aver tralasciato un passaggio o due.
Anche se non ho mai trovato alcun documento ufficiale su questo argomento, molte persone /r/powershellhanno postato su di esso negli ultimi anni. Io presumo che si poteva scavare nel codice github powershell e trovare il processo, ma non ho mai fatto. [ arrossire ]
Presumo anche che qualsiasi sito di golf in codice focalizzato su PoSh avrebbe anche alcune idee su ciò che è coinvolto.