I have a batch script which when given the input "edit", should then echo "hello" as a sort of debug and open the batch scripts file in notepad. However for some inexplicable reason the script will not respond to the if statement no matter what. How do I get it to respond to the "edit" input?
REM @ECHO OFF cd/ cd projects\py_test ECHO Use this batch script to lauch Python modules living in "C:\Projects\py_test\" ONLY. ECHO. SET /P name="Type file name with file extension .py to start or type EDIT to edit this .bat: " REM @ECHO OFF cmd /k IF %name%==edit GOTO EDIT REM IF EXIST %name% py %name% REM IF NOT EXIST %name% echo [101mERROR: The requested file could not be found. Make sure the file exists in "C:\Projects\py_test\" and that the filename includes the ".py" extension.[0m @ECHO OFF :EDIT ECHO HELLO notepad projects-py_test-dot_start.bat`
.pyscript namededit.py. That way the user just enters the name and it is run from python; it'll make the process more understandable and straight forward, and would mean the the end user didn't needlessly have to append.pyto their entry, as it would be a valid suffix on every entry.