Accidentally deleted the Git Shell shortcut - github-for-windows

So where is it? I checked the usual suspects, namely Program Files and Program Files (x86), but I didn't see any mention of GitHub there.

I know someone offered an answer but deleted it for whatever reason before I could accept it, so here goes.
You need to create a shortcut to a command, which is actually rather convoluted.
Right-click on the desktop and do New > Shortcut
Browse to any file, but make sure it's not a .exe file!!
Click next through the rest of the wizard and accept the defaults
Now right-click the shortcut, go to Properties > Shortcut tab
Set the Target to: "C:\Documents and Settings\\AppData\Local\GitHub\GitHub.appref-ms" --open-shell
In step 5 above, the quotes are required.

A better solution is to run
%LOCALAPPDATA%\GitHub\GitHub.appref-ms --reinstall-shortcuts
which will recreate the shortcut on the desktop.

Related

How to stop VScode creating a symlink instead of a file

I have tried to google, this can't find anything or on here so suspect i'm being a noob, so perhaps someone can educate me.
I am copying a file from one directory within by repo in VScode to another. It is a MAKEFILE (which i'm not that familiar with anyway).
I then select copy...
And then i select a sub directory within same directory so i can paste
Once i complete this, rather than the file being copied, it creates a syslink to the file which isn't what i want as i now need to modify the file...
Even if i create the file as a new file, this will still display as a symlink.
Am i doing something stupid here?
I have created the file through the command line but the file still shows as a symlink.
Driving me crazy, please help!
thanks :)
I found the solution here, just complete these steps:
Open VSCode and press Command+Shift+p
Type Uninstall and select option "Uninstall code command from PATH"
Input admin password and then close VSCode once it confirms its been removed
Close VScode application
Re-open VScode and press Command+Shift+p
Type "Install code command to PATH"
Input admin password
Try now and this should work.
I found if i didnt close VScode after removing/adding command to PATH, the setting was lost.
Hope this helps.

How to change folder that opened by default in VSCode?

I have small problem with VSCode folder, that opened by default.
Problem description: I start new instance of VSCode (trough File->New Window), and then if I choose File->Open Folder it opens dialog with my Windows user folder as starting point (C:\Users\MyUser)
Question: How can I change that folder in settings (if it possible)? So by default it will show as start point for example D:\development\ ?
At the time I write this answer, this is not possible. There are two problems on Windows, and one problem on Mac and Linux:
VS Code does not provide a default path to the file dialog 1. It does remember the last folder that you opened a file in, but that path cannot be used as a default because it is overwritten constantly.
On Windows only, Electron ignores the default path when creating a file dialog if the default path is a directory 2.
An extension also cannot solve this, because extensions are not allowed to modify the File menu 3.
I think the best option at this point is to pin a folder to the Quick Access area in Windows Explorer, as suggested in a comment, or to put an actual shortcut in the user profile folder.
Workspaces and File > Open Recent may also be helpful if you often open the same folders.
Your main problem is that you are unable to open your specific folder in VScode.
To solve that you can simply open the terminal/cmd in that specific window by just typing cmd in your search bar or just by pressing shift+right-click in that folder.
Now your cmd is open and you just have to type "code ." in the cmd and press enter to open the current folder in your VSCode.
In case that code . doesn't work for you then you have to add the Vscode in the environment variables of your windows.
Visual Studio doesn't provide a specific feature to open a specific path. But there is a solution to your problem. You are saying that you want D:\develpment as a default when you open VS Code. You can go to that specific directory or create shortcut to desktop then click right click on that folder and then click on open with code. If you didnot see open with code then reinstall your VS code and check on open with code when you are reinstalling VS Code.
make a shortcut on the desktop for vscode and then modify it and add the folder after the .exe command. This will default open that folder when you double click on it.
Visual Studio Code can be installed in two ways - User setup and System setup. I strongly believe you have User setup installed in your PC. Try re-installing it System-wide. That should probably fix your problem.
For more information: https://code.visualstudio.com/docs/setup/windows#_user-setup-versus-system-setup
PS: A lot more information is needed, you can share a screenshot of the window and elaborate more on it.

Open the same directory twice

On command line, I could open a directory like:
code .
Now, I want two of the identical diretory opened and displayed in another window.
(It's not spliting the editor)
Then, I tried again.
code .
Nothing happened.
There's still one directory opened.
How to achieve such a task?
You can do this with the following ways:
1- Manually open a new window (ctrlshiftn) and go to:
File > Add folder to Workspace. Then just select the folder.
2- Open the command panel (ctrlshiftp) enter dupl and hit enter that will duplicate the current workspace in a new window
*dupl is just a filter for the complete command that is: Workspaces: Duplicate Workspace in New Window thanks to dipnlink comment
Source: https://code.visualstudio.com/docs/editor/multi-root-workspaces
*Done in windows (10), vscode (1.35.1)
In the latest version, it is actually much simpler.
In a window of the project you want to duplicate, open the command panel (Command + Shift + P in Mac or Ctrl + Shift + P in Ubuntu), then type dupl (and select Workspaces: Duplicate As Workspace in New Window), this will duplicate your workspace in a new window. Now you can have 2 windows of the same project at the same time.
click
file > duplicate workspace
Click Add workspace folder... and open the same folder. Works for me, other solution doesn't work, just jump focus to another window.
As far as I know, the accepted answer is not correct as C14L indicates.
It can be done by opening a different folder that includes the folder you're working in. So say we have /project and /project/src and /project/build, you're probably interested in having src open in two instances of VSCode, which you can achieve by opening /project and /project/src.
In addition to accepted answer, here's the trick if you want to open same project in two different windows but showing two different git branches:
Copy the project folder and open that folder!
If you want two windows in two different git branches then this simple trick works. I don't know of any other solutions.
The accepted answer works, but I don't really like the fact that the folder is opened into an unnamed workspace, and upon closing window, we will be prompted to save that workspace. I am expecting more like Sublime Text like behavior.
Luckily there is VSCodium, VSCode's twin/clone without telemetry to Microsoft. So I ended up opening the folder once in either VSCode or VSCodium, then a second time in the other. This so far worked quite well for me.
I wanted to do this for working in two branches side by side and then I realized it was not possible because you cannot have two active branches in exact same git repo folder.
So, if you are looking to do the same, you should instead just make a copy of a folder and switch to another branch there. Options described in other answers will not work for this scenario due to fundamental way git works.

Configure Autohotkey to edit scripts with Notepad++

I have my default editor for .ahk files set to Notepad++ Portable on my work laptop, but selecting Edit This Script opens files in the standard Windows Notepad.
A post on the AHK forums suggests editing the registry, but I don't see any entries under HKEY_CLASSES_ROOT\AutoHotkeyScript\Shell\Edit\Command.
How can I configure AutoHotkey to edit scripts with Notepad++?
For whatever reason, the Registry entry doesn't exist by default, but it is recognized by the application once created.
Navigate to HKEY_CLASSES_ROOT\AutoHotkeyScript\Shell in RegEdit.
Right-click the Shell folder, select New > Key and name this Edit.
Right-click the Edit folder, select New > Key and name this Command.
Double click the (Default) string entry in Command.
Paste in "C:\Program Files\Notepad++\Notepad++.exe" "%1" to this window.
Reload AutoHotkey for the changes to take effect.
Note: I don't use Notepad++, but this works for VS Code on my system, and will for N++ as long as the directory information for the executable is correct.
The corresponding .reg file looks like this:
Windows Registry Editor Version 5.00
[HKEY_CLASSES_ROOT\AutoHotkeyScript\Shell\Edit\Command]
#="\"C:\\Program Files\\Notepad++\\notepad++.exe\" \"%1\""
The registry entry in item 5 of the previous answer did not work. I don't even know what the extra %* at the end means, so I simplified it to:
"C:\Program Files\Notepad++\Notepad++.exe" "%1"
For AHK version 2, changing the registry didn't work for me (I tried both Computer\HKEY_CLASSES_ROOT\AutoHotkeyScript\Shell\Edit\Command and Computer\HKEY_CLASSES_ROOT\.ahk\Shell\Edit\Command), but this did it for me. It adds two menu items to the AHK tray menu after a divider:
EditWithNotepadPlusPlus(*)
{
Run "C:\Program Files\Notepad++\notepad++.exe " A_ScriptFullPath
}
EditWithVsCode(*)
{
Run "C:\Program Files\Microsoft VS Code\Code.exe " A_ScriptFullPath
}
A_TrayMenu.Add()
A_TrayMenu.Add("Edit with VS Code", EditWithVsCode)
A_TrayMenu.Add("Edit with Notepad++", EditWithNotepadPlusPlus)
return
If you are like me and you are hesitant to modify the registry, there is a way to do this using AutoHotKey code.
This is a method I use to edit the script with a different editor. Although I am using Visual Studio Code, the method is the same no matter which editor you want to use. One caveat though: we can't change the existing "Edit This Script" menu item, since that is considered one of the standard menu items and can't be modified. Instead I am adding a new menu item at the top of the menu that says "Edit With Notepad++".
EditWithNotepadPlusPlus()
{
Run "C:\Program Files (x86)\Notepad++\notepad++.exe" "%A_ScriptFullPath%"
}
; Remove the standard menu items temporarily
Menu, Tray, NoStandard
; Add our custom menu item labeled "Edit With Notepad++"
; and calls the function above
Menu, Tray, Add, Edit With Notepad++, EditWithNotepadPlusPlus
; Add a separator
Menu, Tray, Add
; Put the standard menu items back, under our custom menu item
Menu, Tray, Standard
Note: If you're wondering, the lines Menu, Tray, NoStandard and Menu, Tray, Standard are not required. The reason I use those lines is because by default, Menu, MenuName, Add adds menu items to the bottom of the menu. For aesthetic and practical reasons, I prefer Exit to be the last menu item. So Menu, Tray, NoStandard and Menu, Tray, Standard will cause our menu item to appear at the top.
One added benefit of this method is that if you transfer your scripts to a new computer, it should still work (provided you have Notepad++ installed on the other computer). If you edit the registry, you have to remember to edit the registry again.
Using AHK v1.1.3.02 on Win10 with string
"C:\Program Files\TextPad 8\TextPad.exe" "%1"
worked well.
The registry change mentioned in other answers for me worked, but you may want to further add the following flags:
C:\Program Files (x86)\Notepad++\notepad++.exe %1 -multiInst -nosession
These flags will stop Notepad++ from recognizing this window as part of your overall session, so it won't overwrite your normal session history or anything. I don't remember where I first found these solutions but I'm switching computers atm and found them in my registry and noticed they weren't mentioned anywhere in this thread.
Was not working for me, i fixed it by first using the suggestion by R River
C:\Program Files (x86)\Notepad++\notepad++.exe %1 -multiInst -nosession
But this would create a new session each time, so i tried removing the end parameters and it now works.
C:\Program Files (x86)\Notepad++\notepad++.exe %1
Simplest way I've found is to:
Right click the .ahk file
Select "Open with" -> "Choose another app"
Check "Always use this app to open .ahk files"
Then select NotePad++ from the list
If it's not listed select "More Apps" and scroll down to NotePad++. (Mind you this example is Windows 10 specific, but previous versions are very similar.)
Editing the registry is great, don't get me wrong, but it takes longer. It's kinda like using a truck to swat a fly! Anyways, hope this works for you. I use it all the time to set the file associations I want.

Install VSCode in a specific folder

I just downloaded the Visual Studio Code App from https://code.visualstudio.com/ and when I tried to install it, it simply just installed it by itself, without the option to change the installation path.
I have an external harddrive, which is where I want the IDE to be placed instead of the Local Harddrive. How can I change this?
On the VSCode download page select "System Installer" instead of "User Installer". The System installer will prompt you for the install location.
Full credit to Hans Passant for giving the following working solution as a comment.
The installer does very little beyond copying the files, it just creates some Explorer context menu shortcuts ("Open with Code"). Otherwise following Chromium conventions and copying itself to c:\Users\yourname\AppData\Local\Code\app-0.1.0 so it can update itself without you noticing. Boo. So high odds that simply moving that folder to the other drive works just fine, put it anywhere and create a shortcut to Code.exe. If you still want the context menu entry to work then use Regedit and search for "code\app-0.1.0".