Relative Content

Tag Archive for windowsbatch-filecmd

Windows cmd for-in file in directory script doesn’t work while copy-pasting does work

I am attempting to loop over every file of a directory using Windows cmd ([Version 10.0.14393]), but I’m encountering a peculiar behavior. When I run the following script as a script, it gives me a syntax error. However, when I copy and paste the code from the script into the terminal, it runs as I would expect (printing the file name of every file in demo. How do I achieve the copy-paste behavior in the script?

Problem with selector in CMD, closes after user type the entry

I am developing a script in which I need the user to select from a list that provides them with the tool they want to use and that depending on this input takes them to the other part of the code. However, since I don’t know much about batch language, I asked ChatGPT and with similar projects that I saw on this site, I tried to do it. The problem in general is when the user types the number and presses enter, the program closes immediately. This is my code: