viewpoint-particle

Author Topic: Can WB Shell out to Bash  (Read 1018 times)

stanl

  • Pundit
  • *****
  • Posts: 801
Can WB Shell out to Bash
« on: January 27, 2018, 03:25:15 am »
in Windows 10?

td

  • Tech Support
  • *****
  • Posts: 2629
    • WinBatch
Re: Can WB Shell out to Bash
« Reply #1 on: January 29, 2018, 07:16:56 am »
Making an assumption or two about the meaning of the term "shell out" and if you happen to have a fully updated version of Windows 10 with Microsoft's bash shell enabled, the following works:

Code: Winbatch
Run('C:\Windows\sysnative\bash.exe', '~')
 
"Success is a lousy teacher. It seduces smart people into thinking they can't lose."
  - Bill Gates


stanl

  • Pundit
  • *****
  • Posts: 801
Re: Can WB Shell out to Bash
« Reply #2 on: January 29, 2018, 11:51:45 am »
Making an assumption or two about the meaning of the term "shell out" and if you happen to have a fully updated version of Windows 10 with Microsoft's bash shell enabled, the following works:

Code: Winbatch
Run('C:\Windows\sysnative\bash.exe', '~')
 

and this would run VI?
Code: Winbatch
Run('C:\Windows\sysnative\bash.exe', '-c "vi"')
 

td

  • Tech Support
  • *****
  • Posts: 2629
    • WinBatch
Re: Can WB Shell out to Bash
« Reply #3 on: January 29, 2018, 01:36:58 pm »
I still have unpleasant dreams about writing vi tutorials for undergrads...

It more or less works that way since it's Linux.  You could save a couple of keystrokes by dropping the double quotes.

"Success is a lousy teacher. It seduces smart people into thinking they can't lose."
  - Bill Gates


JTaylor

  • Pundit
  • *****
  • Posts: 922
    • Data & Stuff Inc.
Re: Can WB Shell out to Bash
« Reply #4 on: January 29, 2018, 01:48:17 pm »
Oooh!!  Oooh!!! Oooh!!!  I love vi.   I use it for most all my development work.   I use Lemmy.   While a bit limited on file sizes it will handle it is much better than Vim.

Jim

stanl

  • Pundit
  • *****
  • Posts: 801
Re: Can WB Shell out to Bash
« Reply #5 on: January 30, 2018, 03:32:42 am »

It more or less works that way since it's Linux.

Thanks. Now from a quick read it appears [again if set up right] windows files can be accessed from  /mnt/c in bash and with Powershell now cross-platform a PS script could be executed. If so, is it a possibility that WB could execute from Bash then recover results from Windows files affected (if you catch my meaning, if you get my drift). 

td

  • Tech Support
  • *****
  • Posts: 2629
    • WinBatch
Re: Can WB Shell out to Bash
« Reply #6 on: January 30, 2018, 06:20:57 am »
WinBatch is a Windows application.  You need WINE to run it on pure Linux.
"Success is a lousy teacher. It seduces smart people into thinking they can't lose."
  - Bill Gates


td

  • Tech Support
  • *****
  • Posts: 2629
    • WinBatch
Re: Can WB Shell out to Bash
« Reply #7 on: January 30, 2018, 06:45:07 am »
Note that you need the Linux PowerShell Core runtime and Core framework to execute Powershell scripts in a Linux environment.
"Success is a lousy teacher. It seduces smart people into thinking they can't lose."
  - Bill Gates


td

  • Tech Support
  • *****
  • Posts: 2629
    • WinBatch
Re: Can WB Shell out to Bash
« Reply #8 on: January 30, 2018, 07:06:08 am »
I take it back.  It is possible to execute Windows applications from the bash shell prompt on Windows 10.  The tricky bit is getting the permissions right and escaping all the special characters in the path.  However, a Windows desktop application started from a bash shell prompt is still running on Windows, in a Windows environment, and on the Windows desktop.
"Success is a lousy teacher. It seduces smart people into thinking they can't lose."
  - Bill Gates