Jump to content

.lnk not working please help

Maxintosh

I have written a few simple cmd commands on a regular notepad and saved it as a batch file (example.bat), of which I have created a shortcut (example.lnk).

I have created a shortcut because that lets me set the layout of how the window opens, window size, window position etc

If I open the shortcut it opens the window how and where I want, but if I open the batch file then it opens in its default size and position set by system

 

Now I want to write another batch file to open all my batch shortcuts (example.lnk) one after the other, so they are placed right where I want on the desktop and sized correctly

 

for e.g

 

@echooff

:start "C:\test\example.lnk"

 

this doesnt open it

 

what should i do ?

 

Motherboard - Gigabyte GA Z170M - D3H | CPU - intel core i7 6700k | CPU Cooler - Cooler Master Hyper 212 cooler | RAM - 32gb Kingston HyperX 2666 (8x4) | Graphics - Nvidia gtx 1060 6gb (Gigabyte) | PSU - Cooler Master B700W PSU | SSD 1 - 120GB Kingston 100 UV SSD (simple storage) | SSD 2 - 240GB kingston 400 UV SSD (OS & programs installed) | Cabinet - Corsair Spec 1 | OS - Windows 10 home Single Language 64bit

 

:) If I helped, hit the thumbs up icon below my post and pick it as 'Best Answer:ph34r:

Link to comment
Share on other sites

Link to post
Share on other sites

.lnk files are handled by the shell, which is why they don't work in CMD.

 

If you want a shortcut that you can use in a batch file, you need to make a symlink out of thing in question. The command is:

MKLINK [[/D] | [/H] | [/J]] Link Target

        /D      Creates a directory symbolic link.  Default is a file
                symbolic link.
        /H      Creates a hard link instead of a symbolic link.
        /J      Creates a Directory Junction.
        Link    specifies the new symbolic link name.
        Target  specifies the path (relative or absolute) that the new link
                refers to.

You need to be an admin to make symlinks.

 

EDIT: Alternatively I believe if you add the path of the program to your PATH environment variable, you can use the program like any other command.

 

EDIT 2: Confirmed this works.

Link to comment
Share on other sites

Link to post
Share on other sites

7 hours ago, M.Yurizaki said:

.lnk files are handled by the shell, which is why they don't work in CMD.

 

If you want a shortcut that you can use in a batch file, you need to make a symlink out of thing in question. The command is:


MKLINK [[/D] | [/H] | [/J]] Link Target

        /D      Creates a directory symbolic link.  Default is a file
                symbolic link.
        /H      Creates a hard link instead of a symbolic link.
        /J      Creates a Directory Junction.
        Link    specifies the new symbolic link name.
        Target  specifies the path (relative or absolute) that the new link
                refers to.

You need to be an admin to make symlinks.

 

EDIT: Alternatively I believe if you add the path of the program to your PATH environment variable, you can use the program like any other command.

 

EDIT 2: Confirmed this works.

Thanks a lot, but since i am new to writing programs or commands, a walk through can help. If thats not too much to ask for ☺️

 

Motherboard - Gigabyte GA Z170M - D3H | CPU - intel core i7 6700k | CPU Cooler - Cooler Master Hyper 212 cooler | RAM - 32gb Kingston HyperX 2666 (8x4) | Graphics - Nvidia gtx 1060 6gb (Gigabyte) | PSU - Cooler Master B700W PSU | SSD 1 - 120GB Kingston 100 UV SSD (simple storage) | SSD 2 - 240GB kingston 400 UV SSD (OS & programs installed) | Cabinet - Corsair Spec 1 | OS - Windows 10 home Single Language 64bit

 

:) If I helped, hit the thumbs up icon below my post and pick it as 'Best Answer:ph34r:

Link to comment
Share on other sites

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×