Avoid copying symlink when already exists

I have a command which creates a couple of symlinks. When accidentally executing a 2nd time, all symlinks will be created again adding (1). I know that I could use DOS-based "if exists...", but is there a "built-in" solution to cancel?

You can use the argument WHENEXISTS=skip with the Copy command.


Doesn't work when using "Copy MAKELINK=softlink ... To ... WHENEXISTS=skip". Any idea, why?

Copy MAKELINK was designed around creating shortcuts, which typically works in that way.

A script or script command which checks the destination and skips creation if it already exists is probably the best way to get what you want.

With the following workaround you'll get an error message if the link already exists:Copy MAKELINK=softlink TO /desktop AS *

Then a script would be best.

Which command do I need to create the symlink (I've never combined a DOS- and a DO-command)?

I would like to create a button (usercommand) like this:

if exist D:Test goto cancel <symlink-command> :cancel Exit :END

Not a DOS batch file. Anything but a DOS batch file. :slight_smile:

Opus has proper JScript / VBScript scripting now.

DOpus.FSUtil.Exists can check if a path exists.

The Simple Script Function example shows how you can run an Opus command from a script.

I know about DO's script-addin, but I have not time to learn JS/VB, so I just will avoid pressing it twice :slight_smile:. But thanks anyway.