PowerShell script will not run from within XYplorer
PowerShell script will not run from within XYplorer
I have a one-line powershell script named myhost.ps1, which is shown below. If I run the script from the the PowerShell command line, it works. If I run it using Start/Run, it works. If I run the script from Explorer, it also works. But if I run it from within XYplorer by double clicking on it, a message flashes, and then it exits.
I have the execution policy set to unrestricted for PowerShell. Any ideas why this will not run from XYplorer?
bash -c "ssh zbernie@myhost"
I have the execution policy set to unrestricted for PowerShell. Any ideas why this will not run from XYplorer?
bash -c "ssh zbernie@myhost"
Re: PowerShell script will not run from within XYplorer
And you don't think that this could be a vague hint?a message flashes
One of my scripts helped you out? Please donate via Paypal
Re: PowerShell script will not run from within XYplorer
It's probably more than a vague hint, but unfortunately as I said, it is displayed for a split second, then disappears. If I could read it I'm sure I would have better insight into the problem.highend wrote:And you don't think that this could be a vague hint?a message flashes
Re: PowerShell script will not run from within XYplorer
Capture the screen, scroll in the preview of that video where the message appears, make a screenshot?
http://www.donationcoder.com/Software/Mouser/esr/
http://www.donationcoder.com/Software/Mouser/esr/
One of my scripts helped you out? Please donate via Paypal
Re: PowerShell script will not run from within XYplorer
First I added a try/catch block to the powershell script, in order to capture the error to a file like this:highend wrote:Capture the screen, scroll in the preview of that video where the message appears, make a screenshot?
http://www.donationcoder.com/Software/Mouser/esr/
try
{
C:\WINDOWS\system32\bash.exe -c "ssh zbernie@myhost"
}
catch [Exception]
{
echo $error | Out-File C:\Users\bernie\PowerShell\Terminals\pshell.log
}
The error below is output to the pshell.log file. I added the full path to bash.exe and still get the error when I run the script from XYplorer. As I said, I can run the script from Windows Explorer, and it runs without error. It also runs without error from the command line. Any idea why bash.exe is not found when the powershell script is fun from XYplorer?
C:\WINDOWS\system32\bash.exe : The term 'C:\WINDOWS\system32\bash.exe' 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.
At C:\Users\bernie\PowerShell\Terminals\sis-app2-prod.ps1:4 char:7
+ C:\WINDOWS\system32\bash.exe -c "ssh bartonbf@sis-app2-prod"
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : ObjectNotFound: (C:\WINDOWS\system32\bash.exe:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
Re: PowerShell script will not run from within XYplorer
Probably because of
Execute it from the address bar
Code: Select all
rtfm "idh_wow64.htm";
One of my scripts helped you out? Please donate via Paypal
Re: PowerShell script will not run from within XYplorer
I tried from the address bar and it does not seem to execute at all. I included the full path to a script like:highend wrote:Probably because ofExecute it from the address barCode: Select all
rtfm "idh_wow64.htm";
C:\Users\bernie\PowerShell\Terminals\sis-TESTING.ps1
Re: PowerShell script will not run from within XYplorer
?
You are supposed to execute the rtfm command from the address bar...
You are supposed to execute the rtfm command from the address bar...
One of my scripts helped you out? Please donate via Paypal
Re: PowerShell script will not run from within XYplorer
Oops! Well, I finally read the fine manual regarding WOW64 redirection. It says that as long as you have this check box ticked:highend wrote:?
You are supposed to execute the rtfm command from the address bar...
"Show the real System32 directory"
The rest of the article is just for reference. I already had that check box ticked. I tried unticking it, and checking others, and still cannot run the PowerScript file from XYplorer. Any other suggestions?
-Thanks
XYPlorer unable to see C:\WINDOWS\system32\bash.exe
I have a PowerShell script which calls C:\WINDOWS\system32\bash.exe. This script runs ok from Windows Explorer, and also runs ok from the command line. But when I run it from XYplorer, I get the error below in red stating CommandNotFoundException. I've tried checking and unchecking the shell integration options to "Show the real System32 directory" and "Show the 64-bit context menu, but I still get the error.
Can anyone suggest how to circumvent this issue of XYplorer's inability to see C:\WINDOWS\system32\bash.exe?
-Thanks
MYSCRIPT.PS1
try
{
C:\WINDOWS\system32\bash.exe -c "ssh zbernie@myhost"
}
catch [Exception]
{
echo $error | Out-File C:\Users\bernie\PowerShell\Terminals\pshell.log
}
ERROR:
C:\WINDOWS\system32\bash.exe : The term 'C:\WINDOWS\system32\bash.exe' 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.
At C:\Users\bernie\PowerShell\Terminals\sis-app2-prod.ps1:4 char:7
+ C:\WINDOWS\system32\bash.exe -c "ssh zbernie@myhost"
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : ObjectNotFound: (C:\WINDOWS\system32\bash.exe:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
Can anyone suggest how to circumvent this issue of XYplorer's inability to see C:\WINDOWS\system32\bash.exe?
-Thanks
MYSCRIPT.PS1
try
{
C:\WINDOWS\system32\bash.exe -c "ssh zbernie@myhost"
}
catch [Exception]
{
echo $error | Out-File C:\Users\bernie\PowerShell\Terminals\pshell.log
}
ERROR:
C:\WINDOWS\system32\bash.exe : The term 'C:\WINDOWS\system32\bash.exe' 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.
At C:\Users\bernie\PowerShell\Terminals\sis-app2-prod.ps1:4 char:7
+ C:\WINDOWS\system32\bash.exe -c "ssh zbernie@myhost"
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : ObjectNotFound: (C:\WINDOWS\system32\bash.exe:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
Re: PowerShell script will not run from within XYplorer
Merged.
Read the part for the sysnative folder...The rest of the article is just for reference
One of my scripts helped you out? Please donate via Paypal
Re: PowerShell script will not run from within XYplorer
highend wrote:Merged.
Read the part for the sysnative folder...The rest of the article is just for reference
I followed the docs and it does not work for me:
"Note: To enable the Sysnative solution you first have to create an empty new folder C:\Windows\Sysnative. Then you can go to e.g. C:\Windows\Sysnative\drivers to access the 64-bit C:\Windows\System32\drivers."
PS C:\WINDOWS\system32> mkdir C:\Windows\Sysnative
Directory: C:\Windows
Mode LastWriteTime Length Name
---- ------------- ------ ----
d----- 3/2/2017 10:29 PM Sysnative
PS C:\WINDOWS\system32> Get-ChildItem C:\Windows\Sysnative\drivers
Get-ChildItem : Cannot find path 'C:\Windows\Sysnative\drivers' because it does not exist.
At line:1 char:1
+ Get-ChildItem C:\Windows\Sysnative\drivers
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : ObjectNotFound: (C:\Windows\Sysnative\drivers:String) [Get-ChildItem], ItemNotFoundExcep
tion
+ FullyQualifiedErrorId : PathNotFound,Microsoft.PowerShell.Commands.GetChildItemCommand
Re: PowerShell script will not run from within XYplorer
And you are in a 64-bit powershell window...Note that 64-bit applications cannot use the Sysnative alias as it is a virtual directory not a real one
Now, what happens when you change your
Code: Select all
C:\WINDOWS\system32\bash.exe -c "ssh zbernie@myhost"
Code: Select all
bash.exe -c "ssh zbernie@myhost"
and execute it from there again?
On this system, it works...
One of my scripts helped you out? Please donate via Paypal
Re: PowerShell script will not run from within XYplorer
Really, it works for you on Windows 10? I had one line in my powershell script:highend wrote:And you are in a 64-bit powershell window...Note that 64-bit applications cannot use the Sysnative alias as it is a virtual directory not a real one
Now, what happens when you change yourtoCode: Select all
C:\WINDOWS\system32\bash.exe -c "ssh zbernie@myhost"
restart XYplorerCode: Select all
bash.exe -c "ssh zbernie@myhost"
and execute it from there again?
On this system, it works...
bash.exe -c "vim"
And I got the error below.
bash.exe : The term 'bash.exe' 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.
At C:\Users\bernie\PowerShell\Terminals\sis-TESTING.ps1:3 char:7
+ bash.exe -c "vim"
+ ~~~~~~~~
+ CategoryInfo : ObjectNotFound: (bash.exe:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
Re: PowerShell script will not run from within XYplorer
ExactlyReally, it works for you on Windows 10?
One of my scripts helped you out? Please donate via Paypal