Is it somehow possible in powershell to skip variables and include the driveletter function directly in the path of executing the command?
. (Get-Volume -FileSystemLabel myHDD).DriveLetter:\temp\ps.ps1
The command should look like:
. D:\temp\ps.ps1
When I run it in powershell, I get this error:
. : The term 'D' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
At line:1 char:3
. (Get-Volume -FileSystemLabel myHDD).DriveLetter:\temp ...
+ CategoryInfo : ObjectNotFound: (D:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
Thanks for your help!
Related
I've researched a few things about opening a venv. I've come to realize I need the PowerShell to allow scripts and so I started this session with:
set-executionpolicy remotesigned
Then I went ahead and tried the following, but it is not going through.
P
S C:\Windows\system32\xxxxx> venv/bin/activate
venv/bin/activate : The term 'venv/bin/activate' is not recognized as the name of a cmdlet, function, script file, or
operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try
again.
At line:1 char:1
+ venv/bin/activate
+ ~~~~~~~~~~~~~~~~~
+ CategoryInfo : ObjectNotFound: (venv/bin/activate:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
PS C:\Windows\system32\xxxxx> source venv/bin/activate
source : The term 'source' is not recognized as the name of a cmdlet, function, script file, or operable program.
Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
At line:1 char:1
+ source venv/bin/activate
+ ~~~~~~
+ CategoryInfo : ObjectNotFound: (source:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
Any suggestions as how to move forward?
I had been following a tutorial and they used venv/bin/activate when it should be venv/Scripts/activate
I am using Anaconda, I have chosen the interpreter as conda.exe in my ENV but still the python command does not work in VS code' s Command Prompt. What to do?
python : The term 'python' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling
of the name, or if a path was included, verify that the path is correct and try again.
At line:1 char:1
+ python
+ ~~~~~~
+ CategoryInfo : ObjectNotFound: (python:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
I registered the 'code' command in PATH, and in cmd and GitBash the command works but in powershell not.
Does anyone know if i need to register somewhere else to be able to use the vscode command in powershell?
#EDIT:
powershell apparently doesn't read directories correctly even in version 7.1
the command 'code' returns:
D:\Program : O termo 'D:\Program' is not recognized as a cmdlet, function, script file or program name
operable. Check the spelling of the name or, if a path has been included, see if the path is correct and try
again.
In line: 1 character: 1
+ D:\Program Files\VSCode-win32-x64-1.52\bin\code.cmd
+ ~~~~~~~~~~
+ CategoryInfo : ObjectNotFound: (D:\Program:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
the command 'yarn -v' returns:
x86: The term 'x86' is not recognized as a cmdlet name, function, script file or operable program. Check the
spelling the name or, if a path has been included, check that the path is correct and try again.
In line: 1 character: 19
+ C:\Program Files (x86)\Yarn\bin\yarn.cmd -v
+ ~~~
+ CategoryInfo : ObjectNotFound: (x86:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
I'm having problems execute the filename.exe (the name is not relevant) from Windows Powershell. The filename.exe can be executed from the cmd easily, because the file's path is added to the PATH environment variable.
So I can execute the filename.exe like this from command line:
filename arg1 arg2
I have no idea how to do so in the Powershell.
Edit:
I've tried the same way but no success. I got the following message
PS D:\> filename
filename : The term 'filename' is not recognized as the name of a cmdlet, function, script file, or operable program.
Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
At line:1 char:1
+ filename
+ ~~~~~~
+ CategoryInfo : ObjectNotFound: (filename:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
If you would like to add an environment variable for that session, in this case update PATH, you can use System.Environment's SetEnvironmentVariable method.
Say, I want to run 7zip, but the path to its executable is not in my path. So if I run it in Powershell, I will get an error:
PS > 7z.exe
7z.exe : The term '7z.exe' is not recognized as the name of a cmdlet, function, script file, or operable program. Check
the spelling of the name, or if a path was included, verify that the path is correct and try again.
At line:1 char:1
+ 7z.exe
+ ~~~~~~
+ CategoryInfo : ObjectNotFound: (7z.exe:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
PS>
Let's add it to the path:
PS> [System.Environment]::SetEnvironmentVariable('PATH',$Env:PATH+';c:\program
files\7-zip')
And now run it again:
PS > 7z.exe
7-Zip [64] 15.09 beta : Copyright (c) 1999-2015 Igor Pavlov : 2015-10-16
I'm trying to run a command that displays several screens of text and I'm trying to use the more command, but it doesn't seem to be working.
When I try to use a command like this:
Get-Help Get-Alias -full | more
I get an error that says this:
more.com : The term 'more.com' is not recognized as the name of a cmdlet, function, script file, or operable program.
Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
At line:14 char:14
+ $input | more.com
+ ~~~~~~~~
+ CategoryInfo : ObjectNotFound: (more.com:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
Anyone have any ideas as to why?
Turns out that powershell.exe was not in the path.