相关疑难解决方法(0)

powershell命令没有在.bat文件中运行?

我正在尝试制作一个简单的脚本来设置我的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)

shell powershell path

4
推荐指数
1
解决办法
2863
查看次数

在PowerShell中无法识别Python 3.6

我在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时,我都希望输入上面的代码.这有点烦人.任何帮助,将不胜感激.谢谢.

python windows powershell

4
推荐指数
2
解决办法
9504
查看次数

在Windows PowerShell中设置环境变量

我无法从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 cmd

3
推荐指数
1
解决办法
9238
查看次数

Powershell和路径环境变量

我想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)

powershell

2
推荐指数
1
解决办法
1403
查看次数

PowerShell问题 - 我必须输入./来运行bat文件

我刚刚安装了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文件?

powershell powershell-2.0

1
推荐指数
1
解决办法
2979
查看次数

使用Windows命令shell无法识别sass

我在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无法识别错误.

我对红宝石很新,所以我很可能错过了一步.

提前致谢

ruby sass

0
推荐指数
1
解决办法
1万
查看次数

标签 统计

powershell ×5

cmd ×1

path ×1

powershell-2.0 ×1

python ×1

ruby ×1

sass ×1

shell ×1

windows ×1