Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.
28997 Discussions

Running files in folders containing blank characters

h_amini
Beginner
336 Views

To run a batch file in folder "test" I read up on system with

result = SYSTEM("C:\test\analysis.bat")

and it works. But if the folder's name has blank characters, the system reads only the characters before the first blank. For instance if the folder is "new example" and I use

result = SYSTEM("C:\new example\analysis.bat")

the following error occurs:

'C:\new' is not recognized as an internal or external command, operable program or batch file.

Could someone let me know how to solve it?

Many thanks

Hamid

0 Kudos
2 Replies
GVautier
New Contributor II
336 Views
Quoting - h.amini

To run a batch file in folder "test" I read up on system with

result = SYSTEM("C:testanalysis.bat")

and it works. But if the folder's name has blank characters, the system reads only the characters before the first blank. For instance if the folder is "new example" and I use

result = SYSTEM("C:new exampleanalysis.bat")

the following error occurs:

'C:new' is not recognized as an internal or external command, operable program or batch file.

Could someone let me know how to solve it?

Many thanks

Hamid


Try this :
result = SYSTEM('"C:new exampleanalysis.bat"')
or
result = SYSTEM("""C:new exampleanalysis.bat""")

Pathes with blank must be enclosed with quotes.
0 Kudos
haminin
Beginner
336 Views
Quoting - gvautier

Try this :
result = SYSTEM('"C:new exampleanalysis.bat"')
or
result = SYSTEM("""C:new exampleanalysis.bat""")

Pathes with blank must be enclosed with quotes.

Thank you very much for this. They both work.
Hamid

(h.amini = haminin)
0 Kudos
Reply