Merging two % data fields into a single one?

Discussion forum for all Windows batch related topics.

Moderator: DosItHelp

Post Reply
Message
Author
Jobe77x
Posts: 2
Joined: 05 Mar 2017 01:35

Merging two % data fields into a single one?

#1 Post by Jobe77x » 05 Mar 2017 01:47

Hi!

I've got a problem with merging two % data fields.

For example:

md f:\testscript\%label_%
xcopy d:\*.* /s /e f:\testscript\%label_%



%label_% is the name of the current DVD in the player.
However, I'm trying to add the %Random% parameter like:

md f:\testscript\%label_%+%random%
xcopy d:\*.* /s /e f:\testscript\%label_% + %random%


So the result would be that it creates for example a dir called alien28361...

I've tried a few solutions with , " ' but I can't for my life remember how to do it

Anybody that knows how?

penpen
Expert
Posts: 2009
Joined: 23 Jun 2013 06:15
Location: Germany

Re: Merging two % data fields into a single one?

#2 Post by penpen » 05 Mar 2017 03:45

This may help you:

Code: Select all

set "label_random=%label_%%random%"
md f:\testscript\%label_random%
xcopy d:\*.* /s /e f:\testscript\%label_random%


Sidenote:
Please use code-tags. Click the "Code button" or manually add the BBCode code-tags for source code:
[code]source[/code]

Examplary result:

Code: Select all

source



penpen

Jobe77x
Posts: 2
Joined: 05 Mar 2017 01:35

Re: Merging two % data fields into a single one?

#3 Post by Jobe77x » 05 Mar 2017 03:57

:D Thanx, it worked perfectly..

Code: Select all

 echo Thanx for this information also

Post Reply