I have installed SAM CLI in C Drive but my codes are in D Drive. As such, in my VSCode, when i try to run "sam init" or "same --version", it throws back an error of 'sam' is not recognized as an internal or external command,operable program or batch file. How can I fix this issue to allow myself to run from D Drive? Or is this not possible?
You need to add that folder into your environment PATH so that your terminal can find the program.
If you type environment
in the windows search bar it should be one of the first results.
Update:
For clarity, you need to restart your terminal as when it opens it will run through a set of initialisation actions to load its own environment (e.g. one of which is setting its PATH environment variable).
When you try and run an executable file, the windows terminal will search the current folder and every folder declared in the PATH to try and find it to run.