Jump to content

Recommended Posts

Posted

I run and maintain a large cmd file to rearrange my start menu and add shortcuts that aren't there to begin with.

Is it possible for someone to write a script that uses "shortcut.exe" or similar method to automatically create shortcuts out of all the files in a directory and place them in a designated area?

A GUI would be awesome, but I'm assuming too much work for a small project like this.

I don't like moving shortcuts around, I would much rather recreate them where I want them. Shortcut works for that but it's a pain to write a command line for every file.

Posted

Could you tell me for what are you using this script? Your local PC or you have a network enviroment with many PC's?

Please specify what should script do, which shortcut from which folder, where to copy etc..

Also, please attach that cmd file you have..

Posted

It will be for personal use. Basically I need a script that will run a loop through all files in a directory.

I'm not sure if you're familiar with the shortcut program I am using. I'm not even sure where I got it anymore. The syntax is:

shortcut.exe /F:"%Filename%" /a:c /T:"%Target%" /W:"%Working Directory%" /I:"%Filename%,0"

shortcut.exe resides in my system32 directory. if you could use that structure and make the filename, target, and working dir variables I could manage the rest.

I started learning C++ a few years ago and stopped because the next class was never offered! I have an idea of what I need but I don't know the syntax for the command line or vbscript. I only learned concepts in C++ we never got to the point where we could use the file system.

  • 1 month later...
Posted
It will be for personal use. Basically I need a script that will run a loop through all files in a directory.

I'm not sure if you're familiar with the shortcut program I am using. I'm not even sure where I got it anymore. The syntax is:

shortcut.exe /F:"%Filename%" /a:c /T:"%Target%" /W:"%Working Directory%" /I:"%Filename%,0"

shortcut.exe resides in my system32 directory. if you could use that structure and make the filename, target, and working dir variables I could manage the rest.

I started learning C++ a few years ago and stopped because the next class was never offered! I have an idea of what I need but I don't know the syntax for the command line or vbscript. I only learned concepts in C++ we never got to the point where we could use the file system.

This isn't in vbscript, but it should be easy enough with 2 batch files.

first.bat

@echo off

xcopy /L "your folder here\*" temp\ > list.txt

FOR /F "tokens=1* delims=~" %%i IN (list.txt) DO SET filename=%%~nxi&set target=%%~fi&set working_directory=%%~dpi&call second.bat

second.bat

%windir%\system32\shortcut.exe /F:"%Filename%" /a:c /T:"%Target%" /W:"%Working Directory%" /I:"%Filename%,0"

Try this and see how it works.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...