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.
Code: monitor-temps.bat:
C:\cygwin\bin\bash.exe ~/bin/monitor-temps.bash
pause
Code: monitor-temps.bash:
#!/usr/bin/bash
"/cygdrive/c/Users/michael/Desktop/apps_and_drivers/GPU-Z.0.4.8.exe" &
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.
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?
Start a Command Prompt as Administrator by right-clicking on the "Command Prompt" icon in the Windows Start Menu and choose "Run as administrator". Click Continue if you are presented with a confirmation popup message box. In the new command prompt, enter "net user administrator /active:yes".
Right click on your Cygwin shortcut or executable and select the "Run as Administrator" option. This should open a Cygwin terminal and give you elevated permissions in that terminal.
Go to http://cygwin.com and click on "Install Cygwin" in the left column. This will allow you to download a setup.exe file and choose "Install from Internet." Click "Next." Choose your settings. For most users, it is fine to leave the default installation directory, which is "c:\cygwin\ and the other default settings.
In cygwin 2.6. 0 (on Win 7 x64) it can be done much easier: cygstart . to open Explorer with the current folder, or any folder syntax cygstart .. , cygstart /your/path etc...
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".
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.
Hope that helps!
I think you have to change the directory or file permission. If you want to change permission of a file or directory then you have to add full path with the code.
As if you want to change permission on cocos2d-x folder on C:\yourDirectory (I'm on Windows; on Mac it would be /
instead of \
) write the code on cygwin console:
chmod -R 775 /cygwindrive/c/yourDirectory
Note: If it's in C: drive you have to run it as administrator.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With