Would someone please suggest a way to execute Windows PowerShell commands (i.e., commands more similar to Unix commands than Command-Prompt commands) in a Jupyter notebook? Please note that I am a layperson.
So far, I have added "C:\ProgramData\Anaconda3\Scripts" to my path system variable, which allows me to run "jupyter-notebook" from either Command Prompt or Windows PowerShell. I guess a shell looks in all folders in my path system variable for an application to run named "juypter-notebook". I guessed that running Jupyter Notebook from Windows PowerShell would allow my Jupyter-Notebook Chrome application to understand PowerShell commands, but this doesn't seem to be the case.
You can execute a PowerShell command from a Jupyter Notebook cell on a Windows machine with:
!Powershell.exe -Command "<PowerShell command>"
For example, if you wanted to print the first 10 lines of the file filename.txt, you could write:
!Powershell.exe -Command "type filename.txt -Head 10"
Source
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With