Pelles C forum
C language => Beginner questions => Topic started by: P_C on February 08, 2011, 05:38:14 PM
-
Hi!
I want to make a *.out file for my program but the Pelles C command prompt says "access denied".
So what to do? because i need to show my program to the teacher.
-
Hi P_C,
Is there a NTFS permisson issue on the folder where you want to create the output file?
-
I don't know, how to check that?
-
What is the path you like to put your file in?
What Windows version are you running on?
-
the path is C:\Users\x\Documents\Pelles C Projects\
and I am running on Win7 64bit.
-
So you are saving to your own documents?
There should be no problem doing so, if the file does not exist and is not used by another program.
-
So you are saving to your own documents?
Two things may be of note here...
1) does that folder actually exist?
2) some command line tools have problems with spaces in path names.
-
I am typing "goto *path*" and then "*.exe>*.out" and it says access denied. maybe i am wrong?
-
Exactly what are you typing... a screenshot would be good...
-
the path is C:\Users\x\Documents\Pelles C Projects
Your project files are under your profile folder so you shouldn't have NTFS permisson issues.
-
(http://img135.imageshack.us/img135/3826/129728645133.png) (http://www.fxp.co.il)
-
Goto does not change the folder, but jumps to a mark when used inside a batch file.
You need to use CD (change directory) instead.
The program files folder structure is write protected, only installers are allowed to write there.
-
Goto does not change the folder, but jumps to a mark when used inside a batch file.
You need to use CD (change directory) instead.
The program files folder structure is write protected, only installers are allowed to write there.
Well, that's not the problem here though, don't know if the fact that goto works here in the first place is a new thing in Windows 7 (Vista?).
The main issue is that he expects to be able to execute an .out file and that is certainly not going to happen. It has to be a .com or .exe file, after all this ain't Linux/Unix he's running on. Not sure if Windows 7/Vista is still recognizing the .cmd extension as it was used in early NT and OS/2...
Ralf
-
I'm on win7 and goto does what it always has... jumps to a label inside a batch program.
The correct command is CD or CHDIR followed by the path where you want to be.
You will know when it works because the path showing to the left of the cursor will change to match your target...
start a shell...
c:\users\name> _ <--- type CD \WINDOWS
c:\Windows> _
I think the whole problem is that he's just not getting into the right directory.
-
I'm on win7 and goto does what it always has... jumps to a label inside a batch program.
The correct command is CD or CHDIR followed by the path where you want to be.
You will know when it works because the path showing to the left of the cursor will change to match your target...
start a shell...
c:\users\name> _ <--- type CD \WINDOWS
c:\Windows> _
I think the whole problem is that he's just not getting into the right directory.
c:\CD C:\
My bad, you're right, the goto doesn't even work as I wrongly assumed it could.
I was checking the forum earlier from my Android phone, and didn't see the blackslashes and pointy brackets right.
He is not actually changing the directory to his project folder and then tried to execute the exercize4c.exe in "C:\Program Files\Pelles C", with an attempted redirection of it's possible output to the file exercize4c.out.
What more so was throwing me off is that the GOTO command doesn't throw an error message about a non-existing label and unless the exercize4c.exe is indeed in the current folder, I would have expected an error message like "command not found" when trying to execute the file in the wrong folder... ???
Ralf
-
Next time you're on a windows machine, open a command shell and type help then hit enter. That'll give you the commands and what they do.
-
Have you tried: Right click on .exe file and set program to run 'As administrator' ? Alternatively, set it to Run as 'you-own-account' (Sounds weird, but is actually
required sometimes)
What is more, you should not try and 'GOTO' a file unless it is script related. And even then, it should be inside a script and not on the commandline.
'goto' will not report an error as there is nothing wrong to report. 'Call' on the other hand, does work on the commandline.
For example: goto anything > tryme.txt would yield a 0-byte file, even if there would be a script\exe file called 'anything' there. It simply does, nothing.