0

I'm creating a command for cmd for which I need to receive text values from cmd and execute them into the batch file. The name of the batch file is abc.bat, which is copied in the default folder of my cmd path.

My Command would be like:

abc some text

ABC.bat looks like:

@echo off
echo %x%

Now I want variable x to get the value "some text" So that whenever I execute

abc qwerty

the command line prints

qwerty
Tanmay Vij
  • 243
  • 1
  • 4
  • 14

1 Answers1

0

You need to set x variable to hold all of the arguments passed to your script in command line, which is achieved by %*, so the code you're asking for is:

@echo off
set x=%*
echo %x%
Quaker
  • 1,483
  • 3
  • 20
  • 36