thedexmonster Posted May 8, 2008 Posted May 8, 2008 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. Quote
NIM Posted May 8, 2008 Posted May 8, 2008 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.. Quote
thedexmonster Posted May 8, 2008 Author Posted May 8, 2008 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. Quote
Jonnyboy Posted June 19, 2008 Posted June 19, 2008 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 offxcopy /L "your folder here\*" temp\ > list.txtFOR /F "tokens=1* delims=~" %%i IN (list.txt) DO SET filename=%%~nxi&set target=%%~fi&set working_directory=%%~dpi&call second.batsecond.bat%windir%\system32\shortcut.exe /F:"%Filename%" /a:c /T:"%Target%" /W:"%Working Directory%" /I:"%Filename%,0"Try this and see how it works. Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.