-
Notifications
You must be signed in to change notification settings - Fork 9
[Question] about executing powershell #7
Comments
1.) search for the 2.) Yes, with JavaScript: https://github.com/egomobile/vscode-powertools/wiki/Commands ... s. example below 3.) No, this is technically not possible ... the VS Code API does not support this 4.) Yes, this is possible: https://github.com/egomobile/vscode-powertools/wiki/Startups#shell-commands 5.) you can use JavaScript for this: https://github.com/egomobile/vscode-powertools/wiki/Events#scripts ... s. example below 6.) your expression works for me ... when I create a Example how to ex const child_process = require('child_process');
exports.execute = async (args) => {
// args => https://egomobile.github.io/vscode-powertools/api/interfaces/contracts.workspacecommandscriptarguments.html
// https://nodejs.org/api/child_process.html#child_processexecfilesyncfile-args-options
const stdout = child_process.execFileSync('C:\\Windows\\System32\\WindowsPowerShell\\v1.0\\powershell.exe', [
"-NoProfile", "-ExecutionPolicy", "Bypass", "-Command"
]);
// OUTPUT >> Power Tools by e.GO
args.output.appendLine('PowerShell output: ' + String(stdout));
}; |
Hi @mkloubertego thanks! can confirm 6.) works like expected, my fault. as of 2.) settings:
mypower.js
It should be done by passing in the taskname instead of hardcoding it, so i will use ${args-command} as identification. Thank you very much for this awesome tools, now i can use one extension for automation instead of two, and it has way more functionality!!! :-) |
Hi @mkloubertego add as of 2.) in mypower.js
args.file is undefined in this script task.json
settings.json unchanged like above How can i pass in file and folder name (mypower.js) ? according to last example of the wiki (last exapmple, it should work this way), I also copied the settings.json in the .vscode folder (this is a portable installation, normally in data/user-data/User) The links to api/interfaces give a 404... Thanks! |
But only, if you execute the command from file explorer:
|
and you have to set the settings |
Hi @mkloubertego well i have to try that again. |
Hi thank you for this amazing tool!
i have some questions(WIN 10):
1.) Applying a setting like this (settings.json):
and running it, nothing is shown in the vscode terminal (the powershell is executed but i would like to start this powershell as task ).
As opposed to when making a task like this in a task.json and running it(output is shown in the Terminal like expected)
2.) Can i start a powershell task via command ? (found nothing in the wiki about that), maybe somewhow via javascript or a workbench action ???
3.)Can i define more then 1 context menu entry per file ending (e.g. when ending is *.txt
"populate" 3 context menu entries to start different powershell tasks,
ending *.json "populate" 4 contextmenu entries to start different powershell tasks)
Now you have to click "execute PowerCommand" and then you choose from the available commands(one click more)
4.) I can execute a powershell script on startup, like on 1.) can i run this as powershell task at startup too ?
5.) for events like "file created" "file.changed" "file.saved" and "file.deleted" i would like to trigger a powershell task (according to the documentation it is not possible) ...? Or would is there a possibility to trigger that from javascript ???
6.) I want some buttons to be shown only on defined endings. e.g. *.xxx or *.yyy , i tried various strings like
"ifFile": "xxx$"
but that does not seem to work ???
Would you be so kind and provide examples for these questions?
Thank you!
The text was updated successfully, but these errors were encountered: