- 1 year ago
In terminal I would use the vi command to create a file inside of a directory: `vi bot.py` (after doing mkdir supreme_bot) how could I do this on cmd?
Comment
1 / 1
In the Windows command prompt (CMD), you can create a file inside a directory using the echo
command and the >
redirection operator. Here's how you can create a file named "bot.py" inside a directory named "supreme_bot":
- Create the "supreme_bot" directory (if it doesn't already exist):
arduinomkdir supreme_bot
- Change to the "supreme_bot" directory:
bashcd supreme_bot
- Create the "bot.py" file using the
echo
command:
bashecho. > bot.py
The echo.
command with a period after it creates an empty line in the "bot.py" file. You can modify the command to include the initial content of the file if needed, for example:
bashecho print("Hello, world!") > bot.py
This would create the "bot.py" file with the specified content.
After executing these commands, you will have the "bot.py" file inside the "supreme_bot" directory. You can then open the file in your preferred text editor to edit its contents.