PowerShell search system path for shortcut - powershell

On Windows, when I enter gvim it finds the file under C:\Program Files (x86) even though that vim directory is not in my system path. So how does it find it?
On Linux, I can enter this command, which shows that there is a link /usr/bin/gvim.
locate gvim
However, that does not work in PowerShell. I also tried this but it does not work because apparently -path expects a single directory.
gci "gvim*" -path "$env:PATH" -r | select FullName
How do I find the shortcut that is used? Answers using PowerShell are preferred, but any elegant solution is okay.

Related

Is there a way I can check when file was created and last edited in VSCcode?

Is there something similar in VSCode like ls -l or ls -lt on Linux, or just plain folder table view in Windows?
In windows, if you're using power shell, you can use ls, if you're using CMD, you can use the command dir.
Now, I don't know if you're trying to make an extension of just list the files in the terminal included in vscode

Powershell does not open using windows explorer shortcut

I usually use the shortcut described here: How do I start PowerShell from Windows Explorer? to open a PS session in a specific folder. Just using powershell to open the sessions
However is no longer working, every time I write powershell on the address bar and hit enter it take me to the folder: C:\Users\MyUser\Documents\PowerShell (I'm in a Windows 10 laptop)
It seems to be related only to this shortcut as I have tried a few other things and they work. List of things I have tried/checked already below:
powershell -noprofile it work opening a PS session as expected
No, my $Profile file does not have anything to set the location of the PS Session.
powershell.exe works as expected
powershell_ise works as expected
going to File --> Open Windows Powershell works as expected
Checked my environment variables and nothing strange there either
It seems to be related to the fact that I installed PS core 6 recently. This installation introduced the folder C:\Users\MyUser\Documents\PowerShell (it's a new folder vs the ones that existed with Windows Powershell) and that's why the windows explorer now opens a folder instead of the command line.
I suppose I will need to get used to powershell.exe instead of powershell from now on.

Getting workspace path in Notepad++ run commands

I am using Notepad++ with workspaces, created through "Open Folder as Workspace".
I am trying to launch external command from Notepad++ using the Run command menu.
The variable FULL_CURRENT_PATH give me the current file path but I need to get the worskpace path to launch some deployment script in the root of the workspace.
Is there a variable for workspace path ?
I'm afraid there is no such variable. You can see a list of all variables in the source code of Notpad++:
https://github.com/notepad-plus-plus/notepad-plus-plus/blob/master/PowerEditor/src/WinControls/StaticDialog/RunDlg/RunDlg.cpp
You can read the Workspace directories from the configuration file, but the file will only be written if Notepad ++ is closed. Maybe someone has an idea how to trigger that
cmd /c echo. |powershell -Command [xml]$nb = Get-Content $env:appdata\Notepad++\config.xml; Write-Output $nb.NotepadPlus.FileBrowser.root.foldername

Copying shortcuts to the desktop

ALL,
I'm working on the program which installs itself in the user selected directory and then creates a shortcuts in the Start Menu for all users. The shortcuts are placed in the folder named by the following scheme:
<foo barx.y.z>
where "foo bar" is the name of the software and the "x.y.z" is the version number.
After installing we run the configuration scripts written in the PowerShell.
Its been decided that those shortcuts needs to be present on the user Desktop as well. So I thought that the easiest and the forward compatible solution would be to just copy those shortcuts at the end of the configuration scripts.
However, when I start the "Command Prompt" terminal inside Windows {7} and tried to do this:
copy "c:\ProgramData\Microsoft\Windows\Start Menu\foo *" c:\Users\igor
I got an error message saying that the system cannot find the file specified.
Can someone shed some light lights? What is the proper way of copying this stuff? Or since I will do it inside PowerShell script everything will be good?
Thank you.
Igor, you can try do something like this (maybe it help you):
copy "c:\ProgramData\Microsoft\Windows\Start Menu\Programs\*Hyper-V*" "c:\Users\$env:UserName" -Recurse -Force

How to delete all exe in a pendrive in linux

There are a lot of exe files in my pen-drive (reside in different directories).
How can I delete all the files using Linux command?
Removes all exe files in the current directory tree.
find . -name "*.exe" -delete
If your pen drive has more than 2 directory , then you need to run this command in each directory.