RENAME in a LNK file

Discussion forum for all Windows batch related topics.

Moderator: DosItHelp

Post Reply
Message
Author
gordonprice67
Posts: 1
Joined: 15 Apr 2013 09:47

RENAME in a LNK file

#1 Post by gordonprice67 » 15 Apr 2013 09:58

For a number of reason I need to use an LNK file rather than a BAT file, to do a RENAME.

I had hoped simply sending the REN via CMD would work. I.e.

Code: Select all

CMD /C /D RENAME "C:\Program Files\Common Files\Autodesk Shared\WSCommCntr4\lib\WSCommCntr4.exe" "WSCommCntr4.exe.OOTB"

The RENAME portion in a Command window works, but when used like this in a LNK file it doesn't. It seems somehow to be related to pathing, because if I use START to effectively run RENAME from the current directory like this...

Code: Select all

CMD /C /D START /D. RENAME "C:\Program Files\Common Files\Autodesk Shared\WSCommCntr4\lib\WSCommCntr4.exe" "WSCommCntr4.exe.OOTB"

It works, but it leaves the second Command window from the START on screen at completion. And setting Start In for the Shortcut to . rather than using START with the /D. switch doesn't work at all.
I also tried adding an Exit to the end of my LNK properties, like this...

Code: Select all

CMD /C /D START /D. RENAME "C:\Program Files\Common Files\Autodesk Shared\WSCommCntr4\lib\WSCommCntr4.exe" "WSCommCntr4.exe.OOTB" &&EXIT

And still no joy.

So, first I am curious why START is even needed, since I am providing a fully qualified path to the file to be renamed. And, more importantly, does anyone have a thought as to how I can get this to work cleanly in a LNK?

Thanks for any insights,
Gordon

abc0502
Posts: 1007
Joined: 26 Oct 2011 22:38
Location: Egypt

Re: RENAME in a LNK file

#2 Post by abc0502 » 15 Apr 2013 17:31

i'm not sure what you are trying to do, but Start Command take the first argument as a cmd window title, so you have to provide a title or an empty double-quotes instead, try this it could help:
CMD /C /D START "" /D. RENAME "C:\Program Files\Common Files\Autodesk Shared\WSCommCntr4\lib\WSCommCntr4.exe" "WSCommCntr4.exe.OOTB"

Aacini
Expert
Posts: 1932
Joined: 06 Dec 2011 22:15
Location: México City, México
Contact:

Re: RENAME in a LNK file

#3 Post by Aacini » 15 Apr 2013 18:26

gordonprice67 wrote:For a number of reason I need to use an LNK file rather than a BAT file, to do a RENAME.

I had hoped simply sending the REN via CMD would work. I.e.

Code: Select all

CMD /C /D RENAME "C:\Program Files\Common Files\Autodesk Shared\WSCommCntr4\lib\WSCommCntr4.exe" "WSCommCntr4.exe.OOTB"

The RENAME portion in a Command window works, but when used like this in a LNK file it doesn't.

Gordon


Excuse me, I think there is a confusion here. A LNK file is just a reference to another file, so both of them refer to the same thing. You may have a LNK file linked to a BAT file, so the execution of anyone of them result in the same thing. There is no way to have a LNK file as an individual entity, so your phrase "when used like this in a LNK file" is nonsense. How do you create an individual LNK file in order to insert anything in it?

Post Reply