“权限被拒绝";在Windows中使用cygwin [英] "Permission Denied" using cygwin in Windows

查看:313
本文介绍了“权限被拒绝";在Windows中使用cygwin的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

背景: 我试图编写一个[.bat]文件,所以我可以双击它,然后将调用bash脚本. bash脚本将启动一些Windows GUI应用程序以监视GPU/CPU温度.我刚刚重新安装了cygwin v1.7.7-1(今天下载)和Windows 7.

Background: I am trying to write a [.bat] file so I can double click it and a bash script will get invoked. The bash script will start up a few windows GUI apps to monitor GPU/CPU temperatures. I just did a fresh install of cygwin v1.7.7-1 (downloaded today) and windows 7.

代码: monitor-temps.bat:

Code: monitor-temps.bat:

C:\cygwin\bin\bash.exe ~/bin/monitor-temps.bash
pause

代码: monitor-temps.bash:

Code: monitor-temps.bash:

#!/usr/bin/bash
"/cygdrive/c/Users/michael/Desktop/apps_and_drivers/GPU-Z.0.4.8.exe" &

输出: 双击[.bat]文件后,我得到一个:

Output: After I double click the [.bat] file, I get a:

C:\Users\michael\Desktop>C:\cygwin\bin\bash.exe ~/bin/monitor-temps.bash

C:\Users\michael\Desktop>pause
Press any key to continue . . . /home/michael/bin/monitor-temps.bash: line 2: /cygdrive/c/Users/michael/Desktop/apps_and_drivers/GPU-Z.0.4.8.exe: Permission denied

当我进入目录并手动执行该应用程序时,仍然会遇到相同的权限错误.

I still get the same permissions error when I cd to the directory and manually execute the application.

权限: 根据我在Linux中遇到的权限问题的经验,一切看起来都不错,因为我是我认为的用户,并且该文件具有预期的权限:

Permissions: From my experience with permission problems in Linux, everything looks good because I am the user I think I am, and the file has the expected permissions:

$ whoami
michael

$ ls -l GPU*
-rwx------+ 1 michael        None 890720 2010-12-01 19:23 GPU-Z.0.4.8.exe

问题: 有谁知道如何解决这一问题?我想念什么吗?

Question: Does anyone know how to fix this? Am I missing something?

推荐答案

作为一名开发人员,我在Windows环境中使用快捷方式提供行为类似于Linux的命令行界面(CLI),并遇到了尝试解压缩文件时遇到相同的问题.

As a Developer, I use a shortcut to provide a command-line interface (CLI) that behaves similar to Linux, in my Windows environment, and ran into the same issue trying to untar a file.

解决方法是将快捷方式设置为以管理员身份运行".

The fix was to set the shortcut to "Run as Administrator".

如果使用此方法访问Cygwin环境,请转到快捷方式的属性,选择高级"按钮以获取以管理员身份运行"的选项,然后选中该复选框,然后单击确定".然后离开你! 您还可以通过为其创建快捷方式并执行上述操作来设置批处理文件来执行此操作.

If you are using this method to access your Cygwin environment, go to the properties of the shortcut, select the Advanced button to get the options to "Run as Administrator", check the box, click Ok. And off you go!! You can also set your batch file to do this, by making a shortcut to it and doing the above.

希望有帮助!

这篇关于“权限被拒绝";在Windows中使用cygwin的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆