Powershell -command text not appearing - powershell

Windows 10, Powershell -v 5.1
I have tried to restore powershell to defaults, both normally and as admin. I have changed/turned off high contrast settings, deleted console files for powershell in Regedit, as well as tried to restore defaults from command line scripts.
Have tried restarting after applying all of this, but much of my output text is invisible, as well as commands with only one "-" dash, but commands with "--" appear.
See in pics below
no - identifiers
Invisible "-i"
Reappearing "--i"
Invisible Surge Data

It sounds like you've persistently modified the console-window colors in a manner that renders certain syntactic elements invisible.
You can either modify your console-window settings interactively - which may be nontrivial - or you can try to restore the original colors by recreating
the shortcut files that start your console windows:
Shortcut files (*.lnk files) contain their own console-window settings, which are independent of the defaults defined for console windows in the [HKEY_CURRENT_USER\Console] registry key and its subkeys named for specific executable names / window titles.
Therefore, even if you remove [HKEY_CURRENT_USER\Console] or specific subkeys, starting a program via a shortcut file will still apply the settings stored inside that shortcut file.
To bypass the shortcut-file settings ad hoc, you can start your program directly, using the Run dialog:
Press WinKey+R and enter powershell (for Windows PowerShell) or pwsh (for PowerShell Core), which applies only the registry defaults, if any.
However, to solve that problem persistently, you must modify or recreate the shortcut
file(s) you use to start your program:
To modify the shortcut:
Invoke your program via the shortcut,
then open the system menu (click on the icon in the top-left corner of the window),
select Properties
and modify the properties, notably the colors via the Colors tab.
To recreate the shortcut (instructions based on Windows 10):
In the Start Menu:
Right-click on the application of interest, then select More > Open file location.
In the taskbar:
Right-click on the application of interest, then right-click the application name and select Properties.
Activate the General tab
Copy the value of the Location: field - the folder in which the *.lnk file is located - to the clipboard.
Open File Explorer and paste the location into its address bar, which should open the folder in which the *.lnk file of interest is located.
Once you've located the *.lnk file of interest:
Make a note of:
its exact filename (typically: Windows PowerShell)
its target command line, by right-clicking the file, selecting Properties, selecting the Shortcut tab and copying the value of the Target: field.
its startup directory, as noted in the Start in: field.
Delete the *.lnk file.
Recreate it with the previously noted target command line:
Right-click in an empty part of the File Explorer window and select New > Shortcut
Paste the command line and click Next.
Specify the previous filename, and click on Finish.
Right-click on the new file, select Properties, and paste the startup directory into field Start in:, then click OK.
Drag the new *.lnk file into the Start Menu and/or taskbar, as needed.

Related

SQL Developer not opening specific folder path set at preferences

I have set a default path to look for scripts.
But on a new worksheet Ctrl+o doesn't open the default folder and leads to temp folder location, whereas ctrl+S opens to the default path set at preferences.
Both actions should lead to the same folder right.
Is my understanding correct ?
What should i do to correct this ?
That preference tells sql developer where to look for scripts when you execute them, via
#script.sql
It has no bearing on what folders you see when opening or saving a file.
Now, once you do open a file from that directory, the next time you go to Open/Save a file, you'll see that directory listed on the left for quicker navigation.

Visual studio code, how to copy the file name

In the visual studio code, it has commands to Copy Path and Copy Relative Path (Ctrl+Shift+p->File: Copy Path of Active File). Is there a way I could copy the active file name instead of the whole path?
If there is no way copy the active file name. Is there a way I could write a script or something which creating a new command based on existing Copy Path and showing the new command in the Command Palette?
The extension Copy file name works like a charm!
CTRL+ALT+F gives you filename and CTRL+ALT+E gives the filename.extension.
open your file on vscode> select file as active file> Ctrl+Shift+P > Alt+Shift+C
now you can use Ctrl+V to paste this path any where you want.
step1. first install "copy file name" extension from extensions(ctrl+shift+X) in your vscode.
step2. then use ctrl+alt+e for copying the full file_name with file_extension(like .cpp or .py or .java etc..).
or ctrl+alt+f for for copying the file_name
without file_extension.
It is been a while but I found if you want to write a script using the currently opened file, create a new task in task.json and calling some scripts in the task might be a good option.
Basically, ${file}, ${fileBasename} and ${fileDirname} are the variables that can be used in your script file.
Useful reference:
https://code.visualstudio.com/docs/editor/variables-reference
As an alternative, if you see the active file in the "Explorer" view, you can type F2 once you select it.
With VSCode 1.71 (Aug. 2022), you can type F2 and:
1st press => prefix
2nd press => all
3rd press => suffix
4th press => cycles back around to prefix
This has been release to VSCode insider today, for you to test/play with it.
Without using any extensions, here's a combination of key shortcuts you can use to copy the path of the current file. It's a bit cumbersome but with some practice can be faster than doing the same using the mouse.
Ctrl+Shift+E to open and focus the Explorer pane.
The current file will be selected automatically by default.
F2 to start renaming the file.
This will select the file name without file extension.
(optional) Ctrl+A to include the file extension in the selection.
Ctrl+C to copy.
Escape to abort renaming (or just click anywhere).
no need any extensions, Ctrl+K --> Ctrl+Shift+C, then you will get relative path

Can VSCode always open a default folder (for Ctrl + P searching) even if opening a file in different folder?

Is it possible to have VSCode always have a particular folder ("Directory A") open, so the files inside can be searched using Ctrl + P?
It seems the standard behaviour is that my current "added folder" (i.e. "Directory A") get removed whenever I open a file from a different location ("Directory B").
Closing VSCode and re-opening it always returns me to the last used file (i.e. opening "Directory B" and NOT "Directory A").
How can I force VSCode to always have a certain folder open please?
NB, I've looked into "workspaces" but this doesn't help as whenever opening a file not in the workspace, it seems to close the workspace.
Add Directory A to your workspace using File > Add Folder to Workspace...
Then rather than opening Directory B when you launch VSCode, open the .vscode-workspace file for the workspace that contains both directories.
If there are multiple files in your workspace which match the filename you're searching for using CTRL+P, all the matching files will show up.
The solution, at least on linux, is to create a script with the following content (let's call the script code-standard-path ):
#!/bin/bash
code /path/to/standardDir-or-standardworkspace "$1"
Then from caja right click on a file : open with -> other application.
Then select the command code-standard-path and check Remember this application for "..." files.
Now everytime you double-click on the specific file from whatever location, vscode will open in that predefined directory or workspace.
You can move a bit further and pass the standard path as first argument to the script (e.g. use code "$1" "$2"). So on the open with menu you provide each time the script like this: code-standard-path /path/to/standardDir-or-standardworkspace.
This gives you the ability to open a differrent standard path depending on the file you open (e.g. for .c, .java, .html)
Had the same issue. But there is an easy fix:
On the menu bar go to file File > Preferences > Settings > Window and under Restore Windows select the option preserve.
This will ALWAYS reopen the last session, no matter if you start VS from shell, desktop shortcut or by opening a file.
Open settings File > Preferences > Settings Or by clicking (ctrl + comma)
Type "include" in search bar
Find "Search > Quick Open: Include History"
Uncheck the option

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.

Custom command for Eclipse on current file

I would like to enhance Eclipse so that when I press a custom key combo--say Ctrl + Shift + E--then it will run a command on the current file (if my current buffer is foo.c then it will run `mycommand foo.c' in foo.c's directory).
Open the External Tools Configuration dialog from the Run menu. Create a new configuration with the following settings.
Location: c:\mycommand.exe (alter to your needs)
Working directory: ${container_loc}
Arguments: ${resource_loc}
Under Prefrences->General->Keys you can setup a shortcut for "Run last launched external tool".
This should solve your problem.
Also, make sure that your "resource" (foo.c) is selected. It happened to me that when testing the external tool and horizontally scrolling the output pane, the resource gets deselected. When you run the external tool again after probably having made changes to its configuration, Eclipse will pop up an error box about "empty variable" (e.g. ${resource_loc} ).