News:

Accounts with zero posts and zero activity during the last months will be deleted periodically to fight SPAM!

Main Menu

Open filename on command line

Started by Pecan, October 26, 2014, 01:18:59 AM

Previous topic - Next topic

Pecan

Can someone tell this thick headed self how to open a file on the command line:

I've tried "codeblocks.exe c:\this.is.a.file"
and
"codeblocks.exe --file=c:\this.is.a.file"

neither works for me.


svn build  rev 9936 (2014-10-10 14:00:08)   gcc 4.6.1 Windows/unicode - 32 bit

stahta01

#1
This almost worked for me.


codeblocks.exe --file="C:\Temp\this.is.a.file"


It got a CB error of
---------------------------
Error
---------------------------
Could not open file C:\Temp\this.is.a.file,
because no extension handler could be found.
---------------------------
OK  
---------------------------

I get the same error with this.

codeblocks.exe --file=C:\Temp\this.is.a.file


Windows 7 32 bit.

Added c file extension and this command worked on opening it in CB


codeblocks.exe --file=C:\Temp\this.is.a.file.c



Tim S.
C Programmer working to learn more about C++.
On Windows 10 64 bit and Windows 11 64 bit.
--
When in doubt, read the CB WiKi FAQ. [url="http://wiki.codeblocks.org"]http://wiki.codeblocks.org[/url]

scarphin

Maybe the file extension should be inserted to cb's extension handler to point to the internal editor? Just a guess!

Pecan

Reading the code(thanks for the hint staht01), CB will only handle certain extentions for which it has handler to open the files.

I circumvented the code with a personal hack, and am happy I can use CB for a generalized editor now.

MortenMacFly

Well a proper solution would be to show the same dialog we do show in case you open a file without extension handler from the file open dialog.
Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: [url="https://www.codeblocks.org/docs/main_codeblocks_en.html"]https://www.codeblocks.org/docs/main_codeblocks_en.html[/url]
C::B FAQ: [url="https://wiki.codeblocks.org/index.php?title=FAQ"]https://wiki.codeblocks.org/index.php?title=FAQ[/url]