WinBatch® Technical Support Forum

All Things WinBatch => WinBatch => Topic started by: stanl on January 27, 2018, 03:25:15 AM

Title: Can WB Shell out to Bash
Post by: stanl on January 27, 2018, 03:25:15 AM
in Windows 10?
Title: Re: Can WB Shell out to Bash
Post by: td 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) Select
Run('C:\Windows\sysnative\bash.exe', '~')
Title: Re: Can WB Shell out to Bash
Post by: stanl on January 29, 2018, 11:51:45 AM
Quote from: td 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) Select
Run('C:\Windows\sysnative\bash.exe', '~')


and this would run VI?
Code (WINBATCH) Select

Run('C:\Windows\sysnative\bash.exe', '-c "vi"')
Title: Re: Can WB Shell out to Bash
Post by: td 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.

Title: Re: Can WB Shell out to Bash
Post by: JTaylor 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
Title: Re: Can WB Shell out to Bash
Post by: stanl on January 30, 2018, 03:32:42 AM
Quote from: td on January 29, 2018, 01:36:58 PM

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). 
Title: Re: Can WB Shell out to Bash
Post by: td on January 30, 2018, 06:20:57 AM
WinBatch is a Windows application.  You need WINE to run it on pure Linux.
Title: Re: Can WB Shell out to Bash
Post by: td 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.
Title: Re: Can WB Shell out to Bash
Post by: td 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.