1.

Solve : Shortcut with folder name?

Answer»

Perhaps you don't realise that every time you do a cd.. command, the current directory changes?
Quote from: ira on OCTOBER 13, 2015, 10:32:42 AM

Naming the shortcut is not the problem. It is where it puts the shortcut. I have TRIED using you formula but I just cant seem to get a shortcut in the current directory. Below is my directory structure

D:\Users\tertom01\Desktop\BatchFiles\6568\dwg cont\working
this is where I want my shortcut deposited.

D:\Users\tertom01\Desktop\BatchFiles\6568\Drawings-Uncontrolled\Ref
this is the shortcut link address

thanx


So why don't you specify where you want the shortcut to be created?

e.g. D:\Users\tertom01\Desktop\BatchFiles\mkshortcut /target:"%cd%" /shortcut:"D:\Users\tertom01\Desktop\BatchFiles\6568\dwg cont\working\Ref"

This will create a link in the folder "D:\Users\tertom01\Desktop\BatchFiles\6568\dwg cont\working".

The link will be called "Ref.lnk"

The link will point to whatever folder %cd% is at the time the BATCH script is run.

Finally figured it out. See below. Believe it or not I thought about this for hours. But I find my self starting to understand how variables and such thing WORK. thanks again for you time SALMON Trout.

@echo off
cls
set a=%cd%
cd ..\
cd ..\
mkdir "Drawings-Uncontrolled\Ref"
CD "Drawings-Uncontrolled\Ref"
for %%A in (".") do set b=%%~nA
D:\Users\tertom01\Desktop\BatchFiles\mkshortcut /target:"%cd%" /shortcut:"%a%\%b%"



Discussion

No Comment Found