0

I have a Fortran file where at a certain point I have to write a command line into a batch file. This works well:

CHARACTER*260 TLINE1
. . .
TLINE1= 'c:\Programme\OriginLab\Origin2015\Origin92_64.exe'
. . .   
WRITE(4,'(1A260)')TLINE1

and in my Batch-File I get

c:\Programme\OriginLab\Origin2015\Origin92_64.exe

Now I want to add another Text. I want to have in my Batch-File this line:

start "" c:\Programme\OriginLab\Origin2015\Origin92_64.exe 

My problem now is that I cannot write the ""-characters into that line directly. I tried this but it won`t work:

CHARACTER*260 TLINE1
. . .   
TLINE1= 'start "" c:\Programme\OriginLab\Origin2015\Origin92_64.exe'
. . .
WRITE(4,'(1A260)')TLINE1

Do I have to wrap these characters somehow?

edit:

I tried:

TLINE1= 'start '"' c:\Programme\OriginLab\Origin2015\Origin92_64.exe'
TLINE1= 'start '""' c:\Programme\OriginLab\Origin2015\Origin92_64.exe'
TLINE1= 'start '"''"' c:\Programme\OriginLab\Origin2015\Origin92_64.exe'

but nothing worked. Fortran didn`t compile. Message: error#6054 A character data type is required in this context

I got the solution for my question:

  TLINE1= ' c:\Programme\OriginLab\Origin2015\Origin92_64.exe'
  T1A = 'start "" '
  TLINE2 = ' -c %TEMP%\amix'
  TLINEGES =trim(T1A)//trim(TLINE1)//trim(TLINE2)
user3443063
  • 1,169
  • 2
  • 17
  • 30
  • 1
    What do you get as output if it isn't as you'd expect it? – francescalus Feb 07 '18 at 09:44
  • Please *never* use *"It won't work"* or *"it doesn't work"*. It does not tell us anything useful. Tell us what happened. What was exactly wrong? – Vladimir F Feb 07 '18 at 10:08
  • Related https://stackoverflow.com/questions/30997887/difference-between-double-and-single-quotation-marks-in-fortran – Vladimir F Feb 07 '18 at 10:09
  • I tried the solution given in the link - still got this error – user3443063 Feb 07 '18 at 10:43
  • @user3443063 what compiler are you using? – Pierre de Buyl Feb 07 '18 at 10:48
  • Also, what is your target Fortran standard? – Pierre de Buyl Feb 07 '18 at 10:49
  • I use Microsoft Visual F# 2013 – user3443063 Feb 07 '18 at 10:52
  • 1
    You don't need to try any of those three added (and each is wrong): as the linked answers try to explain, the literal `'"'` is a double quote. There's no need to nest, or use the "triple" form. Your `TLINE1= 'start "" c:\Programme\OriginLab\Origin2015\Origin92_64.exe'` should be correct. Please give the result of that. – francescalus Feb 07 '18 at 10:53
  • When doing so I get Error #5120 Undetermined character constant, Compilation is aborted – user3443063 Feb 07 '18 at 10:58
  • Can you try with a declaration as `character(len=260)` ? – Pierre de Buyl Feb 07 '18 at 10:59
  • I did it with 2 variables that I pasted together. This worked fine: TLINE1= ' c:\Programme\OriginLab\Origin2015\Origin92_64.exe' T1A = 'start "" ' TLINEGES =trim(T1A)//trim(TLINE1) – user3443063 Feb 07 '18 at 11:09
  • Can you update the question instead with proper formatting and a concise explanation of what you did? (aim, code, error message) – Pierre de Buyl Feb 07 '18 at 11:10
  • There is no reason that a plain `TLINE1= 'start "" c:\Programme\OriginLab\Origin2015\Origin92_64.exe'` should not work. You might have a temporary workaround but it is a stretch to call it a solution in the perspective of other readers on SO having a similar problem. – Pierre de Buyl Feb 07 '18 at 11:16

0 Answers0