我正在尝试制作一个简单的脚本来设置我的gcc变量.作为.bat文件.
变量设置如下
$env:Path += ";C:\Users\Brett\Compilers\MinGW\bin"
Run Code Online (Sandbox Code Playgroud)
当我输入/粘贴到电源外壳时运行正常.
但当我粘贴到脚本myscript.bat,并通过powershell运行它时,我收到此错误:
C:\Users\Brett\Compilers>"$env:Path += ";C:\Users\Brett\Compilers\MinGW\bin""
The filename, directory name, or volume label syntax is incorrect.
PS C:\Users\Scruffy\Compilers>
Run Code Online (Sandbox Code Playgroud) 我在Windows 10 PC中安装了python 3.6.我也使用Pycharm来制作我的脚本.我在那里跑得很好.但我的问题是我无法在powershell中运行python.我被告知只需在powershell中键入'python',它应该自动启动python.但是,我得到一个错误,说它不被识别.
Windows PowerShell
Copyright (C) Microsoft Corporation. All rights reserved.
PS C:\Users\lenovo> python
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
Run Code Online (Sandbox Code Playgroud)
有人建议输入:
[Environment]::SetEnvironmentVariable("Path", "$enc:Path;C:\Users\lenovo\AppData\Local\Programs\Python\Python36")
Run Code Online (Sandbox Code Playgroud)
上面代码中给出的路径对我的PC来说是正确的.事实上,Python在我提供上述代码后运行.但是,这是我的问题.每次我关闭并再次打开powershell时,我必须输入上面的代码才能运行python.我尝试在作为管理员运行的Powershell中输入此内容.但是,它不起作用.我甚至尝试重新启动我的电脑,但问题仍然无法解决.
每次我想在新的PowerShell窗口中运行python时,我都希望输入上面的代码.这有点烦人.任何帮助,将不胜感激.谢谢.
我无法从CMD复制此命令
set APPDATA=D:\.
我拥有的最好的等价物是Set-Variable -Name $env:APPDATA -Value D:\.这不起作用!
完整的脚本是:
set APPDATA=D:\
start java -jar D:\.minecraft\minecraft.jar
Run Code Online (Sandbox Code Playgroud)
这样就设置了Java D:\,.minecraft而不是APPDATA.
完整的PowerShell版本(不能正常工作)是:
& Set-Variable -Name $env:APPDATA -Value D:\
& 'C:\Program Files\Java\jre1.8.0_66\bin\java.exe' -jar D:\.minecraft\Minecraft.jar
Run Code Online (Sandbox Code Playgroud)
它仍然看着只读版本$env:APPDATA.我不明白为什么它不能在shell的会话的运行环境中更改,比如cmd和大多数*nix shell!
我敢肯定,这是你的更多的用途比刚刚运行的Minecraft.:P
我想powershell使用环境变量"PATH"来解析可执行文件.我敢肯定它应该可以做到这一点,但这就是我得到的.
PS C:\> $PSVersionTable.PSVersion
Major Minor Build Revision
----- ----- ----- --------
4 0 -1 -1
PS C:\> ${ENV:PATH} = "C:\WINDOWS\System32\"
PS C:\> ls ${ENV:PATH}\cmd.exe
Directory: C:\WINDOWS\System32
Mode LastWriteTime Length Name
---- ------------- ------ ----
-a--- 22/08/2013 8:03 PM 355840 cmd.exe
PS C:\> & cmd.exe
& : The term 'cmd.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 …Run Code Online (Sandbox Code Playgroud) 我刚刚安装了PHP和Yii Framework.它工作正常,我玩CMD.但过了一段时间我转而使用PowerShell ISE.我导航到Yii文件夹:
cd C:\ dev\yii-1.1.9.r3527\framework
我发出命令:
yiic.bat
我收到一个错误:
PS C:\dev\yii-1.1.9.r3527\framework> yiic.bat
The term 'yiic.bat' 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:9
+ yiic.bat <<<<
+ CategoryInfo : ObjectNotFound: (yiic.bat:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
Run Code Online (Sandbox Code Playgroud)
但是,当我键入:
./yiic.bat
进入PowerShell窗口,它工作正常.
有没有一种方法来aviod打字./我每次运行时BAT文件?
我在Win 7 Enterprise盒子上安装了ruby和sass gem.我在整个过程中遇到了问题,不得不下载宝石并从本地安装以避免其他问题.
gem install --local sass-3.1.19.gem
Run Code Online (Sandbox Code Playgroud)
我正在尝试,sass --watch styles.sass:styles.css但我从命令行得到标准sass无法识别错误.
我对红宝石很新,所以我很可能错过了一步.
提前致谢