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

Jayjar291
  • 22
  • 7

1 Answers1

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.

Community
  • 1
  • 1
Aacini
  • 65,180
  • 12
  • 72
  • 108