Output redirection to a file is not working.
Hi,I am running C program on windows server 2008, I want to redirect it's output to some file.But it seems the redirection is not working in 2k8 as i get an empty file each time.I have tried both > and >> operators for this purpose.The same program when i run on Window server 2003 redirects output properly.Can anybody tell me the reason and any alternative for redirection.Thanks in advance.
November 20th, 2008 8:04am
Can you please confirm whether you have at leastNTFS write or modify permission on the folder? I had the same issue previously and I had to explicitly grant my account modify permission to a folder (using icacls.exe) in order for my output file to get generated inside the folder.Regards,Salvador Manaois IIIC|EH MCSE MCSA MCITP|Server/Enterprise AdminBytes & Badz : http://badzmanaois.blogspot.com/
Free Windows Admin Tool Kit Click here and download it now
November 20th, 2008 8:59am
I am logged in using adminstrator account, So there shouldn't be any such problem. Moreover, the program is not generating output file. I am redirecting the output to a file.e.g.output.exe > file.txtThe file "file.txt"gets created but it remains empty.
November 20th, 2008 7:17pm
There was a bug in the program i was running that's why this behavior was there. But i am still not getting why same program is showing different behavior on win2k3 and win2k8.
Free Windows Admin Tool Kit Click here and download it now
November 22nd, 2008 9:14am
even if you're logged in as the local admin, i would still run the cmd prompt with elevated administrator privilages (run as)and see what the behaviour is...UAC can have some odd issues...
November 23rd, 2008 5:47pm
Hi,I would suggest to check the following.To check the permission or a problem with output.exe:
Go to the Command Prompt
Ensure you are in the same path where you want to execute output.exe
run this command "Dir > hello.txt" (It must create hello.txt)
See the content of hello.txt either by opening in Notepad or run this command in the same path "Type hello.txt" (This must show the content of the directory)
IF command in steps 3 and 4 perfectly working fine then there must be some issue with output.exe program otherwise there are permission problem as suggested above.
Keep us writing and hope this will help you to resolve the issue.Regards,TilakIT Consultant
Free Windows Admin Tool Kit Click here and download it now
November 24th, 2008 10:10am
Maybe "output.exe" is not writing to the "Standard Output" but explicit to the screen.> and >> redirects output to Std. Output, whereas 2> redirects Standard Error.- Duelund
November 24th, 2008 1:17pm