# CALL SYSTEM from Fortran

#### oph

I found a problem with CALL SYSTEM from Fortran under Windows 7 64 bits.

The following small program:

call system('dir')
stop
end

shows the dir.

Under Windows XP 32 bits the directory shown is the current working directory (it is correct).

Under Windows 7 64 bits, the directory shown is the root directory n(it is a problem).

The same program shows the current working directory (the correct) when I run it from cmd.

Similar problems with other commands as delete, copy, etc.

Regards.

#### Steve Fabian

From: oph
| I found a problem with CALL SYSTEM from Fortran under Windows 7 64
| bits.
|
| The following small program:
|
| call system('dir')
| stop
| end
|
| shows the dir.
|
| Under Windows XP 32 bits the directory shown is the current working
| directory (it is correct).
|
| Under Windows 7 64 bits, the directory shown is the root directory
| n(it is a problem).
|
| The same program shows the current working directory (the correct)
| when I run it from cmd.
|
| Similar problems with other commands as delete, copy, etc.

I suspect that your TCSTART.BTM on Win7 contains a command to change directory, while the one on your WinXP system does not.
--
HTH, Steve

#### vefatica

The last I knew (a long time ago) "system" (in "C") used CMD.EXE regardless of
%COMSPEC. Has that changed? Is it different with Fortran?

On Mon, 23 May 2011 09:19:19 -0400, Steve Fabian <> wrote:

|From: oph
|| I found a problem with CALL SYSTEM from Fortran under Windows 7 64
|| bits.
||
|| The following small program:
||
|| call system('dir')
|| stop
|| end
||
|| shows the dir.
||
|| Under Windows XP 32 bits the directory shown is the current working
|| directory (it is correct).
||
|| Under Windows 7 64 bits, the directory shown is the root directory
|| n(it is a problem).
||
|| The same program shows the current working directory (the correct)
|| when I run it from cmd.
||
|| Similar problems with other commands as delete, copy, etc.
|
|I suspect that your TCSTART.BTM on Win7 contains a command to change directory, while the one on your WinXP system does not.

#### Steve Fabian

From: vefatica
| The last I knew (a long time ago) "system" (in "C") used CMD.EXE
| regardless of
| %COMSPEC. Has that changed? Is it different with Fortran?

That would depend on the RTL used when linking. With an MS-supplied RTL I'd not be surprised the above to be true.
--
Steve

#### oph

From: oph

I suspect that your TCSTART.BTM on Win7 contains a command to change directory, while the one on your WinXP system does not.
--
HTH, Steve

Yes, it was the cause of the problem.

Thank you!

Regards

Replies
5
Views
294
Replies
3
Views
329
Replies
2
Views
267
Replies
24
Views
2K
Replies
9
Views
1K
Replies
9
Views
3K
Replies
0
Views
909
Replies
13
Views
2K
Replies
0
Views
1K
Replies
9
Views
2K
Replies
3
Views
2K
Replies
4
Views
1K
Replies
4
Views
2K
Replies
59
Views
10K
Replies
35
Views
10K
Replies
7
Views
5K
Replies
0
Views
273
Replies
1
Views
354
Replies
6
Views
2K
Replies
4
Views
1K
Replies
3
Views
4K
Replies
4
Views
1K
Replies
3
Views
1K
Replies
15
Views
4K
Replies
11
Views
4K
Replies
14
Views
2K
Replies
2
Views
2K
Replies
2
Views
2K
Replies
3
Views
1K
Replies
1
Views
2K
Replies
13
Views
10K
Replies
8
Views
2K
Replies
1
Views
1K
Replies
4
Views
1K
Replies
4
Views
2K
Replies
4
Views
2K
Replies
5
Views
3K
Replies
12
Views
2K
Replies
30
Views
7K
Replies
4
Views
3K
Replies
13
Views
3K
Replies
46
Views
9K
Replies
6
Views
2K
Replies
20
Views
5K
Replies
4
Views
4K
Replies
3
Views
4K
Replies
8
Views
7K