H
H
hazestalker2014-08-18 16:16:51
cmd/bat
hazestalker, 2014-08-18 16:16:51

How to correctly put the "-" character in front of a variable in bat?

The code:

set f6=42 3t
robocopy -%f6% "R:\%f6%"

gives ERROR: Invalid parameter #1 : "-42"
I don't know where to put quotes and dashes to make it work
Without a dash it works, but you need it
With a full path
robocopy "E:\folder\-%f6%" "R:\%f6%"
it also works

Answer the question

In order to leave comments, you need to log in

1 answer(s)
H
hazestalker, 2014-08-18
@hazestalker

Found a way out
Before the dash "-" it was necessary to put ".\"

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question