command passing to PowerShell

103 views
Skip to first unread message

Dan Bromberg

unread,
Oct 9, 2018, 9:37:00 PM10/9/18
to qap-s...@googlegroups.com
Jean,

Would it be possible to pass a command to PowerShell thru QAP?

Specifically, I would like QAP to open PowerShell as an Administrator and have this command waiting for me to press ENTER:
image.png

I'm able to get the Admin PowerShell window to open in QAP but cannot get the command to automatically fill in after the ( ...\system32>) prompt.

Thanks,
Dan

Jean Lalonde

unread,
Oct 9, 2018, 11:00:54 PM10/9/18
to Quick Access Popup Support
Hi Dan,

I don't see t feasible as-is. But you may try to put your command in a batch file (e.g. "ps.bat"), for example, and launch this batch from QAP in admin mode :

@echo off
echo OK to launch command set-MpPreference? (Control-C to cancel)
pause
set-MpPreference etc...

See below how to set your "Application" favorite:


Francisco Oldani (Peni)

unread,
Oct 10, 2018, 12:20:49 AM10/10/18
to Quick Access Popup Support
You can try with -Command. Ex: -Command Clear-RecycleBin -Force in the parameters box
It works for me

Dan Bromberg

unread,
Oct 10, 2018, 12:53:05 PM10/10/18
to qap-s...@googlegroups.com
Jean,
  Thanks for your suggestion but when I go through QAP and put:

Set-MpPreference -EnableControlledFolderAccess Enabled
pause

into its own 'bat' file and point to it through the QAP PARAMETERS panel, I got this error from PowerShell:
image.png

but if I execute Set-MpPreference -EnableControlledFolderAccess Enabled
directly in PowerShell there is no problem.

Thanks again,
Dan



On Wed, Oct 10, 2018 at 12:20 AM Francisco Oldani (Peni) <pen...@gmail.com> wrote:
You can try with -Command. Ex: -Command Clear-RecycleBin -Force in the parameters box
It works for me

--
You received this message because you are subscribed to the Google Groups "Quick Access Popup Support" group.
To unsubscribe from this group and stop receiving emails from it, send an email to qap-support...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/qap-support/b686c220-d61b-48f8-b3e6-28bb81cb8e73%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Dan Bromberg

unread,
Oct 10, 2018, 12:54:57 PM10/10/18
to qap-s...@googlegroups.com
Francisco,
   Thanks, but I need to use PowerShell, not Command.
Dan

On Wed, Oct 10, 2018 at 12:20 AM Francisco Oldani (Peni) <pen...@gmail.com> wrote:
You can try with -Command. Ex: -Command Clear-RecycleBin -Force in the parameters box
It works for me

--

Horst Epp

unread,
Oct 10, 2018, 1:45:54 PM10/10/18
to Quick Access Popup Support
That can of course not work as the command processor doesn't know a command Set-MpPreference.
You have to start Powershell and not Set-MpPreference
As parameter you have to give the powershell cmd-let with its parameters. 

Dan Bromberg

unread,
Oct 10, 2018, 1:52:18 PM10/10/18
to qap-s...@googlegroups.com
Horst Epp'
:
Sorry, but I do not understand your reply.
There is no problem running the command (Set-MpPreference -EnableControlledFolderAccess Enabled) in Powershell
which is all I want to do through QAP.

Dan

Horst Epp

unread,
Oct 10, 2018, 2:03:59 PM10/10/18
to Quick Access Popup Support
You try to start directly Set-MpPreference in a batch command which can't work of course.
Powershell commands can only work as parameters to Powershell.exe or inside of scripts.
So you have to create a Powershell script which fetches its arguments provided by QAP or from batch.

Dan Bromberg

unread,
Oct 10, 2018, 2:10:21 PM10/10/18
to qap-s...@googlegroups.com
Horst Epp:
   Agreed! This is precisely the question I posed to Jean.
   Sorry if I wasn't clear enough, but I want to pass this command to PS through QAP...so how do I do it?
   I put the command into a bat file as Jean suggested but for some reason PS did not understand it the same way as when I enter the command directly into PS.
Dan

Jean Lalonde

unread,
Oct 10, 2018, 2:27:36 PM10/10/18
to Quick Access Popup Support
Of course, PowerShell commands cannot be called from a bat file. It has to be in a Powershell script. My bad.

>    Sorry if I wasn't clear enough, but I want to pass this command to PS through QAP...so how do I do it?

Create a PowerShelp script, including, for example:

Set-MpPreference etc.
write-host " #!# Press any key to continue..."
[void][System.Console]::ReadKey($true)

Save it under c:\temp\MyScript.ps1 in this example. In QAP, create an Application favorite with

Basic Settings - Path:
C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe

Advanced Settings - Parameters (including the quotes)
"C:\Temp\MyScript.ps1"

Advanced Settings - Elevate application...
Checked if admin right is required

Dan Bromberg

unread,
Oct 10, 2018, 4:09:51 PM10/10/18
to qap-s...@googlegroups.com
Jean,
   PowerShell is new for me so I never would have caught that it requires a script, so thanks.

   However, when I followed your directions it does not work (QAP starts PS but it terminates immediately).
   In fact, when this is the only line in the script: 
       write-host " #!# Press any key to continue..."
 QAP starts up PS but immediately the screen disappears (err message and all, so I cannot even read the error message).
 So apparently PS is not understanding what is being passed to it. 
 Can you run the same test to verify?
Thanks,
Dan
  

--
You received this message because you are subscribed to the Google Groups "Quick Access Popup Support" group.
To unsubscribe from this group and stop receiving emails from it, send an email to qap-support...@googlegroups.com.

Jean Lalonde

unread,
Oct 10, 2018, 4:36:03 PM10/10/18
to Quick Access Popup Support
This is probably because your system is not allowing PowerShell script execution. See:

Dan Bromberg

unread,
Oct 10, 2018, 6:09:43 PM10/10/18
to qap-s...@googlegroups.com
Jean:

You were right on the money, I had to give myself permission so thanks for that PS tidbit. 

I did get the script to work within QAP but what I really want is for QAP to:
1) start PS in admin mode (which it does) 
2) after the prompt, just populate with the Set-MpPreference... command
3) and just sit there, waiting for me to either hit ENTER or modify a parameter and then hit ENTER

Can that be done?
Thanks so much for your timely replies,
Dan

--
You received this message because you are subscribed to the Google Groups "Quick Access Popup Support" group.
To unsubscribe from this group and stop receiving emails from it, send an email to qap-support...@googlegroups.com.

Jean Lalonde

unread,
Oct 10, 2018, 7:56:16 PM10/10/18
to Quick Access Popup Support
This brings us back to your original post. I don't think it is feasible. This is why I suggested a batch/script with a pause allowing you to cancel if you do not want to proceed with the command. But you could not edit or add to the command before pressing Enter. Maybe some scripting with AutoHotkey would allow this. But this is beyond the scope of this group. You coud see here: http://www.autohotkey.com

Francisco Oldani (Peni)

unread,
Oct 11, 2018, 12:15:54 AM10/11/18
to Quick Access Popup Support
Sorry, is to hard for me explain me in english, in application C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe and in parameters section  -Command <etc>

Horst Epp

unread,
Oct 11, 2018, 9:06:12 AM10/11/18
to Quick Access Popup Support
Why don't you specify parameters and fetch them in your PS script.
There are many ways to handle script arguments in Powershell.

Dan Bromberg

unread,
Oct 11, 2018, 5:37:28 PM10/11/18
to qap-s...@googlegroups.com
Jean,

  I set up 2 PS scripts within QAP: one to turn OFF the command and one to turn it back ON. This suits my needs, so no need to beat this to death any further - thanks very much for your guidance.

  But that led me to wonder, rather than take up precious real estate on your GUI, is there a way I can request the ">" (like you have with "MY SPECIAL FOLDERS")
which would open up my 'sub items' when I hover over it?

Thanks!
Dan


--
You received this message because you are subscribed to the Google Groups "Quick Access Popup Support" group.
To unsubscribe from this group and stop receiving emails from it, send an email to qap-support...@googlegroups.com.

Jean Lalonde

unread,
Oct 11, 2018, 5:51:00 PM10/11/18
to Quick Access Popup Support
Hi Dan,

Since this is off-topic, I'll follow-up with you privately to clarify your suggestion.

Jean

jm

unread,
Oct 28, 2018, 4:11:59 AM10/28/18
to qap-s...@googlegroups.com
Hi,

just upgraded to 9.2.1 (aslo upgraded TC to 9.21, how cute), and I noticed the TC Dir Hotlist submenu just contains 'Close this menu', not all my entries.

I have TC configured in the settings with the right path to wincmd.ini. This was working at some point (though I do not know for sure it broke with the upgrades)

thanks!

Horst Epp

unread,
Oct 28, 2018, 5:35:21 AM10/28/18
to Quick Access Popup Support
I also have TC 9.21a and QAP 9.2.1 and there is no problem to see the TC Dir Hotlist for me.
So there is at least no general problem with this combination.

Jean Lalonde

unread,
Oct 28, 2018, 9:26:23 AM10/28/18
to Quick Access Popup Support
> just upgraded to 9.2.1 (aslo upgraded TC to 9.21, how cute)

:-)

> I have TC configured in the settings with the right path to wincmd.ini.

To be sure it is the correct ini file, please open the file you see in the Options and check if there is a [DirMenu] section with your favorites under it?

@Horst: Thanks for checking this.

jm

unread,
Oct 28, 2018, 9:38:41 AM10/28/18
to qap-s...@googlegroups.com
On Sun, Oct 28, 2018 at 2:26 PM Jean Lalonde <jlalo...@gmail.com> wrote:
> just upgraded to 9.2.1 (aslo upgraded TC to 9.21, how cute)

:-)

> I have TC configured in the settings with the right path to wincmd.ini.

To be sure it is the correct ini file, please open the file you see in the Options and check if there is a [DirMenu] section with your favorites under it?

I have this

[DirMenu] 
RedirectSection=hotlist.ini

This used to work before. Aslo tested with a full path to hotlist.ini in wincmd.ini, same issue.

thanks

@Horst: Thanks for checking this.

--
You received this message because you are subscribed to the Google Groups "Quick Access Popup Support" group.
To unsubscribe from this group and stop receiving emails from it, send an email to qap-support...@googlegroups.com.

Jean Lalonde

unread,
Oct 28, 2018, 9:50:52 AM10/28/18
to Quick Access Popup Support
QAP supports the Total Commander parameter "AlternateUserIni" in [Configuration] section of wincmd.ini. But I was not aware of this possibilitity.

I assume the hotlist.ini file is in the same folder as wincmd.ini. Correct ?


jm

unread,
Oct 28, 2018, 10:48:50 AM10/28/18
to qap-s...@googlegroups.com
you sure you didn't support RedirectSection=hotlist.ini ?


On Sun, Oct 28, 2018 at 2:50 PM Jean Lalonde <jlalo...@gmail.com> wrote:
QAP supports the Total Commander parameter "AlternateUserIni" in [Configuration] section of wincmd.ini. But I was not aware of this possibilitity.

I assume the hotlist.ini file is in the same folder as wincmd.ini. Correct ?


--
You received this message because you are subscribed to the Google Groups "Quick Access Popup Support" group.
To unsubscribe from this group and stop receiving emails from it, send an email to qap-support...@googlegroups.com.

Jean Lalonde

unread,
Oct 28, 2018, 10:50:43 AM10/28/18
to Quick Access Popup Support
My error. I just found that this was discussed in 2016

There is a work around described in this comment. Is this what you tried? At that time, it was reported as a working solution.

jm

unread,
Oct 28, 2018, 11:08:40 AM10/28/18
to qap-s...@googlegroups.com
ok, just tried that, it works. But for clarity, what it means is just setting in QAP:
TotalCommanderWinCmd=C:\Users\...\hotlist.ini



--
You received this message because you are subscribed to the Google Groups "Quick Access Popup Support" group.
To unsubscribe from this group and stop receiving emails from it, send an email to qap-support...@googlegroups.com.

Jean Lalonde

unread,
Oct 28, 2018, 11:56:08 AM10/28/18
to Quick Access Popup Support
I'll follow up with you in private.

Thanks for reporting this, jm.

Reply all
Reply to author
Forward
This conversation is locked
You cannot reply and perform actions on locked conversations.
0 new messages