Custom command line interpreter

Things you’d like to miss in the future...
nerdweed
Posts: 648
Joined: 25 Feb 2012 07:47

Custom command line interpreter

Post by nerdweed »

This falls in between a bug and wish

1. The custom command line interpreter doesn't work with shortnames. If I type powershell in Windows Run dialog it works, but in the text box, this doesn't work and we need to give the full path

2. There are two versions (x86 and x64) for PowerShell. I tried giving both paths, but it always open the 32 bit version if I enter ! in the address bar. If I navigate to the directory and launch them, the correct versions are launched.

The show real system32 checkbox is ticked.

TheQwerty
Posts: 4373
Joined: 03 Aug 2007 22:30

Re: Custom command line interpreter

Post by TheQwerty »

1. Confirmed, it doesn't work here either.

2. Maybe confirmed...

I get 32-bit using any of these:
  • %winsysdir%\WindowsPowerShell\v1.0\powershell.exe
  • C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe
  • C:\Windows\SysWOW64\WindowsPowerShell\v1.0\powershell.exe
I get 64-bit using either of these:
  • %winsysnative%\WindowsPowerShell\v1.0\powershell.exe
  • C:\Windows\SysNative\WindowsPowerShell\v1.0\powershell.exe

nerdweed
Posts: 648
Joined: 25 Feb 2012 07:47

Re: Custom command line interpreter

Post by nerdweed »

Thanks. %winsysnative%\WindowsPowerShell\v1.0\powershell.exe opens 64 bit. I hadn't tried this %winsysnative% earlier.

admin
Site Admin
Posts: 60288
Joined: 22 May 2004 16:48
Location: Win8.1 @100%, Win10 @100%
Contact:

Re: Custom command line interpreter

Post by admin »

1. Tried a fix...

nerdweed
Posts: 648
Joined: 25 Feb 2012 07:47

Re: Custom command line interpreter

Post by nerdweed »

Doesn't work. Powershell launches and disappears. I couldn't get the error message, but I tried replacing powershell with notepad

It gives me the below error.
---------------------------
Notepad
---------------------------
Cannot find the /k .txt file.

Do you want to create a new file?
---------------------------
Yes No Cancel
---------------------------
The /k switch is causing the issue it seems and hence I tried to launch powershell with /k form command prompt and it gave me the below error.
/k : The term '/k' 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 line:1 char:1
+ /k
+ ~~
+ CategoryInfo : ObjectNotFound: (/k:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException

admin
Site Admin
Posts: 60288
Joined: 22 May 2004 16:48
Location: Win8.1 @100%, Win10 @100%
Contact:

Re: Custom command line interpreter

Post by admin »

Don't know which syntax is needed. At least it's called now. So I think my part is done.

nerdweed
Posts: 648
Joined: 25 Feb 2012 07:47

Re: Custom command line interpreter

Post by nerdweed »

The syntax without the /k :titter:

admin
Site Admin
Posts: 60288
Joined: 22 May 2004 16:48
Location: Win8.1 @100%, Win10 @100%
Contact:

Re: Custom command line interpreter

Post by admin »

I did not do any /k. :?

TheQwerty
Posts: 4373
Joined: 03 Aug 2007 22:30

Re: Custom command line interpreter

Post by TheQwerty »

admin wrote:I did not do any /k. :?
Sure looks like you add '/c' for !! and '/k' for ! if the arguments field is left blank.

We can work around this though by setting that field to '<command>'.

This does make me wonder if we need separate argument fields for '!' vs '!!'?

nerdweed
Posts: 648
Joined: 25 Feb 2012 07:47

Re: Custom command line interpreter

Post by nerdweed »

Ok, I tried following four commands and third and fourth one works

!pause
!ls;pause
!!pause
!!ls;pause

BTW, this opens 32 bit powershell and don't think Don would be able to control that. I shall stick to %winsysnative%\WindowsPowerShell\v1.0\powershell.exe
Last edited by nerdweed on 14 Jan 2016 20:22, edited 1 time in total.

admin
Site Admin
Posts: 60288
Joined: 22 May 2004 16:48
Location: Win8.1 @100%, Win10 @100%
Contact:

Re: Custom command line interpreter

Post by admin »

1. Ups, right. Will fix.

2. No time for this now. :)

admin
Site Admin
Posts: 60288
Joined: 22 May 2004 16:48
Location: Win8.1 @100%, Win10 @100%
Contact:

Re: Custom command line interpreter

Post by admin »

nerdweed wrote:Ok, I tried following four commands and third and fourth one works

!pause
!ls;pause
!!pause
!!ls;pause

BTW, this opens 32 bit powershell and don't think Don would be able to control that. I shall stick to %winsysnative%\WindowsPowerShell\v1.0\powershell.exe
All four will work in next ver.

Yes, 32 bit powershell is called when you just pass "powershell".

TheQwerty
Posts: 4373
Joined: 03 Aug 2007 22:30

Re: Custom command line interpreter

Post by TheQwerty »

Not really liking 16.10.0308... :?

I was using:
Exe: 'C:\Windows\SysNative\cmd.exe'
Args: ''
Which gave me the native cmd instead of the 32-bit one and worked correctly for ! and !! (presumably a stroke of luck though).

Now both ! and !! just open a command prompt but do not execute the command.
To get that to work I have to start Args or my command with either '/c' or '/k' which means I cannot take advantage of having both ! and !! work differently.

Meanwhile using:
Exe: 'powershell'
Args: ''
Both ! and !! behave the same and end the shell right after the command. Like above we need to make use of additional arguments such as '-NoExit'.


That said, it does look like the behavior is now correct and logical, but I think I'll missing having ! and !! work differently.
I know you say no time for that now (at least I think that's what you meant by #2), but here's hoping you find the time sooner rather than later. :cup:

Until then I suppose I'll be trying to train myself to instead use @! and @!!. :(

admin
Site Admin
Posts: 60288
Joined: 22 May 2004 16:48
Location: Win8.1 @100%, Win10 @100%
Contact:

Re: Custom command line interpreter

Post by admin »

I will re-add /k and /c for cmd.exe. That should do, right?

nerdweed
Posts: 648
Joined: 25 Feb 2012 07:47

Re: Custom command line interpreter

Post by nerdweed »

In 309
With shortname
! and !! don't seem to do anything
!ls and !!ls - do a directory listing and exit

With the longname, %winsysnative%\WindowsPowerShell\v1.0\powershell.exe
!, !!, !ls and !!ls all behave the same. - They just open a window

This is breaking a lot of things.

Probably, that /c and /k is required for all full paths. And short paths don't need /k

Post Reply