janhoedt
asked on
Powershell: VSCode, file, => go to parent path in powershell console?
Hi,
When, in Visual Studio Code, I need to run a PS1, I obviously need to go (in the VSCode Powershell console) to the path of the file first.
F.e. path is c:\whateverfolder\folder\f older\anot herfolder\ scripts\ma in.ps1
What I do is, select file, right mouse, "copy path", then copy path, paste it into the console remove the filename, and cd to it
=> cd c:\whateverfolder\folder\f older\anot herfolder\ scripts\
There has to be an easier way right? Isn't there an option to "go to parent path of file"?
Please advise,
J
When, in Visual Studio Code, I need to run a PS1, I obviously need to go (in the VSCode Powershell console) to the path of the file first.
F.e. path is c:\whateverfolder\folder\f
What I do is, select file, right mouse, "copy path", then copy path, paste it into the console remove the filename, and cd to it
=> cd c:\whateverfolder\folder\f
There has to be an easier way right? Isn't there an option to "go to parent path of file"?
Please advise,
J
ASKER
Obviuously using that extension. What is that related to my question? It does not have the option 'go to parent path' on a ps1 file
If you have the .PS1 file open, you can just press F5 to run the script.
You don't have to have the current directory in the terminal set to the location of the script, you can just provide the full path to the script, or the relative path to script (i.e. relative to the current directory). For example, if the current directory is c:\temp\child and the script is located in c:\temp, you could use either of these:
- c:\temp\script.ps1
- ..\script.ps1
(remember, "." is current directory, ".." is parent directory)
You don't have to have the current directory in the terminal set to the location of the script, you can just provide the full path to the script, or the relative path to script (i.e. relative to the current directory). For example, if the current directory is c:\temp\child and the script is located in c:\temp, you could use either of these:
- c:\temp\script.ps1
- ..\script.ps1
(remember, "." is current directory, ".." is parent directory)
ASKER
I dont think you understand my question, please read it and see screenshot. Specifically the text in red.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
No answer, please close ticket.
ASKER
The console here extension in VSCode opens (with ctrl + rightmouse on folder) the folder location.
bp[/b]]
»[b