Deleting a shortcut of a folder which is in $windir - nsis

My requirement is to delete a shortcut to a folder. The folder named test is in $windir. The shortcut to that folder is on the desktop. My nsis script should delete that shortcut. What is the script line to do so?

The name of the shortcuts target does not matter, a shortcut is just a file with a hidden .lnk extension.
Delete "$desktop\nameofyourshortcut.lnk"

Related

Sublime Text: How do I rename the Directory in which I'm editing?

I opened my folder called 'Tsunami++' in sublime text and I want to be able to rename it without having to close sublime text, open file explorer, find the folder, rename it, and open sublime again.
When I right-click the folder and select the rename option, type a new name, and hit enter, I get a quick 5 second message at the bottom that says
Unable to rename: [WinError 5] Access is denied: 'C:\\Users\\ramal\\Desktop\\Tsunami++' -> 'C:\\Users\\ramal\\Desktop\\Tsunami-plus-plus'
It says access is denied, shows the path to the directory, and what the path would be with the new name
I checked if the name was valid, and it was.
I checked if there was already a folder in my Desktop folder called Tsunami-plus-plus, and there wasn't, so it's not a matter of name validity or name collisions
My end goal is to be able to change the name of my current working directory within Sublime Text. How do I do this? What do I do to fix this error?
close Sublime Text
edit ~/Library/Application Support/Sublime Text/Local/Session.sublime_session by changing dir to dir2 (making sure you avoid errors there; do this at your own risk)
rename dir to dir2
re-open Sublime Text

Open Sublime from cmd windows 10

I can't open the sublime application or any file via within sublime from the command line. I am currently using Git Bash(SDK-64). I followed this tutorial. I am stumped I am still getting the bash error. bash: subl.exe: command not found
Are you sure, you have Program File folder in C directory? As far as I know C directory has Program Files folder. Add s in Program File.
Write C:\Program Files\Sublime Text 3 instead of C:\\Program File\Sublime Text 3. It should work.
Is necessary to only add your Sublime directory path to the Path list, as you have done in your first pic and use only one "/".
Second step from last picture is not necessary.
Sublime will open with "subl.exe" and can take as argument the name of a file. "subl.exe dummy.txt".
I checked in Git Bash, Powershell and Developer Command Prompt for VS 2017 on win 10.

Open folder in Command Prompt and path of current folder

When I click «Open in Command Prompt» in Visual Studio Code selected folder (C:\playground\ng2\app) should open in command line. But in command prompt display path C:\
printscreen
Have you configured the AutoRun setting for cmd.exe to cd \?

How to make a new directory and a file in Vim

When using Vim as a text editor, is there a way to create new directories and files, while in text editor mode? Instead of going back to the command line and creating a new directory and file.
If you are in the file explorer mode, you can use:
d for creating a directory
% for creating a new file
You can get into the explorer mode with issuing a command :Sexplore or :Vexplore
There is no need to call external commands with !
Assuming you're running a shell, I would shell out for either of these commands. Enter command mode with Esc, and then:
:! touch new-file.txt
:! mkdir new-directory
A great plugin for these actions is vim-eunuch, which gives you syntactic sugar for shell commands. Here's the latter example, using vim-eunuch:
:Mdkir new-directory
Switch to file browsing mode
:Ex or if that is not working use :Explore
then press
d
and add the new directory name.
Assuming you just ran vim on new file in the directory that does not exist:
vim new_dir/new_file.txt
When you try :w you will get 'E212: Can't open file for writing'
To create new directory and file use this:
:!mkdir -p %:h
For the sake of completeness:
Shell out and use normal commands, such as :!mkdir my_dir and :!touch foo.txt (as mentioned in Jake's answer here) will create the directory and file in CURRENT working directory, which is the directory when you started your current vim process in the beginning, but NOT NECESSARILY the same directory of the file that you are currently editing, or the same directory that your :Explore explorer is currently viewing. When in doubt, always use :!pwd to check your current working directory first, and use relative path when necessary.
So if your project contains multiple sub-directories, a more convenient way is to:
type :Explore to enter the explorer mode first,
and then you can easily navigate to whatever sub-directory you like, by typing up-arrow or down-arrow (or j or k) to move cursor, typing Enter to enter a sub-directory, typing - to go up a level of directory. (Note that, all these navigation does NOT change your current working directory either);
Now you can type d to be prompted for a directory name, or type % to be prompted for a file name, and then they will be created in the directory currently shown on screen.
PS: These keys are actually mentioned in the built-in help F1.
Alternatively you can use :e . to get to explorer mode and then hit d .to create the new directory .Thought a shorter answer might be better

Setting up gVim on windows

I am trying to get gVim working on a windows 7 machine and am having the following problems:
Whenever I try to change the _vimrc file, I get a message saying that I don't have permission to save in this location. This is on my home pc btw.
I can't seem to change the directory where the files I edit are being saved. They are all being saved to my desktop at the moment. I tried :set dir=path to where I want to save... with no success.
I wanted to run through vimtutor; however, whenever I type vimtutor into cmd, vim flashes open for a second then closes.
How do I alter the _vimrc file and how do I set the destination for edited files?
I find many people do it differently. Here's how I organize my configurations on windows.
First note that I don't believe in mixing my vim configurations with the stock vim installation. So I don't write or modify files in %PROGRAMFILES% or %PROGRAMFILES(x86)%.
My vim configurations work on different platforms (OS X, linux, windows). And I keep them organized in a .vim folder and a .vimrc file.
Some of my windows machines have cygwin and others do not. On the ones without cygwin, I put my .vim folder and my _vimrc file in %USERPROFILE%. On the ones with cygwin, I put my .vim folder and my _vimrc file in my cygwin user's home directory.
%HOME% is not defined on windows OOTB, so I define it. I find setx.exe is easy...
Example: setx HOME %USERPROFILE% or setx HOME d:\cygwin\home\myname
Alternatively, you can add environment variables via the control panel.
Note, you can copy/store the .vim folder and _vimrc file in %HOME%. But I like to keep them in a git repo elsewhere on my machine and link to them. On windows, I use mlink /d %HOME%\.vim location_of_vim_folder to link the .vim folder. And mlink /h %HOME%\_vimrc location_of_dot_vimrc_file to link the .vimrc to _vimrc file.
Note, you should have write permissions to your %HOME% folder defined above... so this should solve your problem with permissions. (You need to be an administrator to write to %PROGRAMFILES% or %PROGRAMFILES(x86)%
In my vimrc, I have a bit of boiler plate stuff for windows:
"g:my_vim_dir is used elsewhere in my vim configurations
let g:my_vim_dir=expand("$HOME/.vim")
"$HOME/.vim and $HOME/.vim/after are in the &rtp on unix
"But on windows, they need to be added.
if has("win16") || has("win32") || has("win64")
"add g:my_vim_dir to the front of the runtimepath
execute "set rtp^=".g:my_vim_dir
"add g:my_vim_dir\after to the end of the runtimepath
execute "set rtp+=".g:my_vim_dir."\\after"
"Note, pathogen#infect() looks for the 'bundle' folder in each path
"of the &rtp, where the last dir in the '&rtp path' is not 'after'. The
"<path>\bundle\*\after folders will be added if and only if
"the corresponding <path>\after folder is in the &rtp before
"pathogen#infect() is called. So it is very important to add the above
"'after' folder.
"(This applies to vim plugins such as snipmate, tabularize, etc.. that
" are loaded by pathogen (and perhaps vundle too.))
" Not necessary, but I like to cleanup &rtp to use \ instead of /
" when on windows machines
let &rtp=substitute(&rtp,"[/]","\\","g")
"On windows, if called from cygwin or msys, the shell needs to be changed
"to cmd.exe to work with certain plugins that expect cmd.exe on windows versions
"of vim.
if &shell=~#'bash$'
set shell=$COMSPEC " sets shell to correct path for cmd.exe
endif
endif
"Then I load pathogen... (Or if you prefer, you could load vundle bundles here if you wish )
I can't seem to change the directory where the files I edit are being saved. They are all being saved to my desktop at the moment. I tried :set dir=path to where I want to save... with no success.
dir is the location for swap files, which are special backing files used by Vim at runtime.
What you want is cd or lcd which changes the current directory. Type :help cd inside of Vim for more info.
How do I alter the _vimrc file and how do I set the destination for edited files?
I have _vimrc in my Vim folder ($VIM), so when I want to put Vim on a new Windows machine I just copy my entire folder.

Resources