0

Hi I need to run a file witch contains batch code from cmd and is not a batch file.

I have tested cmd < test.bob
and it gets one line in and ends

I did this before but I don't remember the code i think it was cmd /v:on < test.bob
or cmd /E:on < test.bob
please help me

note please don't tell me to change the extension

14
  • 1
    Is there non-batch data in test.bob, or is it just a renamed .bat file? And if it is a renamed batch file, why not just change the extension? Commented Aug 10, 2015 at 2:48
  • It is it just a renamed .bat file i cant use .bat i need to use .JJIS I used .bob in the post Commented Aug 10, 2015 at 3:04
  • Just out of curiosity, why can't you change the extension? Commented Aug 10, 2015 at 3:12
  • i did it before i want to do it again Commented Aug 10, 2015 at 3:14
  • As long as you don't care what it outputs to the screen and you don't want it to be even remotely interactive, you can use cmd /k<test.bob Commented Aug 10, 2015 at 3:22

1 Answer 1

1

You can do that this way:

cmd < test.bob

If you use Delayed Expansion in your "Not Batch file", use this:

cmd /V:ON < test.bob

However, there are several differences that apply to the "Not Batch file"; the most important one is that the following Batch file features don't works in the "Not Batch file":

  • Access to Batch file parameters via %1 %2 ... and execution of SHIFT command.
  • Execution of GOTO command.
  • Execution of CALL :NAME command (internal subroutine).
  • Execution of SETLOCAL/ENDLOCAL commands.

The complete description of the way to do this ("Execute a text file with no .BAT extension as a Batch file") is described at this post, with examples and recommendations.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.