Lucas Szaron
Lucas Szaron

Reputation: 21

Take a word from a special place in the string

The thing i need help is if the user types the string: commandLine("Dir") then it will take the Dir from commandLine("Dir") and make it to a variable

Example:

C:\> program.bat commandLine("Dir")

program.bat:

echo the command is: Dir

pause

Upvotes: 0

Views: 52

Answers (1)

Cyclotron
Cyclotron

Reputation: 339

Try this:

echo off
set str=%1
set str=%str:CommandLine("=%
set str=%str:")=%
echo on
echo the command is: %str%

Upvotes: 1

Related Questions