[Fortran] 纯文本查看 复制代码
program main
USE IFPORT
implicit none
integer :: i
! i=system('for /f "skip=3 delims=" %%a in ('find ":\" "D:\LL\桌面\搜狗高速浏览器.lnk" ') do echo %%a > t.txt') ! 编译失败
! i=system('for /f ""skip=3 delims="" %%a in ('find "":\"" ""D:\LL\桌面\搜狗高速浏览器.lnk"" ') do echo %%a > t.txt') ! 运行失败
i=system("for /f ""skip=3 delims="" %%a in ('find "":\"" ""D:\LL\桌面\搜狗高速浏览器.lnk"" ') do echo %%a > t.txt") ! 运行失败
stop
end program
[Fortran] 纯文本查看 复制代码
program main
USE IFPORT
implicit none
integer :: i
character :: s_lnk*256
s_lnk = "D:\LL\桌面\搜狗高速浏览器.lnk"
i=system("for /f ""skip=3 delims="" %%a in ('find "":\"" """// trim(s_lnk) //""" ') do echo %%a > t.txt")
write(*,*) "for /f ""skip=3 delims="" %%a in ('find "":\"" """// trim(s_lnk) //""" ') do echo %%a > t.txt"
! 此时write得到的字符串与写在.bat文件中能正常执行的代码一模一样!编译也没有问题,但是在system函数中就是不能运行。郁闷啊!!!
stop
end program