in SWI Prolog terminal how do I view the current working directory and change the current working directory?
I found:
working_directory(CWD, CWD)
but I dont think its what I need
in SWI Prolog terminal how do I view the current working directory and change the current working directory?
I found:
working_directory(CWD, CWD)
but I dont think its what I need
To get the current working directory use working_directory(CWD, CWD)
.
To change the current working directory use working_directory(_, NewCWD)
.
Check here to see the manual entry for this predicate.
working_directory(_, '/home/research/Artificial Intelligence/prolog').
–
Maier working_directory/2
on Windows and the change will change both the drive and directory as opposed to same drive different directory, then you need to also call working_directory/2
a second time with just the drive letter to change drives. e.g. You are on C:\Users\Foo
and need to change to D:\foo\bar
then you will need to use working_directory/2
again just with the drive letter. working_directory(_,"D:/")
. –
Infiltration very easy just open prolog on terminal and write working_directory(CWD,'NewPath')
.
Ex: working_directory(CWD,'/home/user/prologExerc')
.
To view the current directory use : pwd
.
And to change it use : working_directory(CWD,'path_or_location')
.
Example : working_directory(CWD,'C:/Users/Student/Destop')
.
Remember to change the direction of slashes in the path name.
© 2022 - 2024 — McMap. All rights reserved.