I am writing a program that is similar to the "cd" command but uses shortcuts.
(to save a path: cds -s 1 C:\saved\directory\path) (to switch to a saved path: cds 1)
To do this I have tried both chdir() and system() but the effect only lasts as long as the program is running. Once the program terminates the path is restored to what it was before the program was run. I am currently using a work-around by loading my program with a bat file which runs another bat file(that contains the cd command) which was created by the program.
so my bat file is similar to:
cds.exe %1 %2 %3
C:\temp\cds_cmd.bat
del C:\temp\cds_cmd.bat
cds_cmd.bat is generated by cds.exe
I would really like to know if there is any other way I could do this without using bat files.
I found and read Is there any way to change directory using C language? but did not find what I was looking for.