You can use either for or forfiles for this task. Forfiles is more flexible, but it might not work properly on older versions of Windows.
From a command prompt:
for %a in ("C:\Documents and Settings\All Users\Desktop\Remote agent *.lnk") do @start "" "%a"
In a batch file:
for %%a in ("C:\Documents and Settings\All Users\Desktop\Remote agent *.lnk") do @start "" "%%a"
forfiles /P "C:\Documents and Settings\All Users\Desktop" /M "Remote agent *.lnk" /C "cmd /C start \"\" @path"
Forfiles goes through all files in the path specified in
/P that match the mask specified on
/M and executes the command specified in
@path is the full path of the file.
Normally, we'd use the command
start "" "Remote Agent 1234.lnk" to launch the shortcut. Since start is an internal command, we have to call it in a new shell (
\"\" are just escaped double quotes, since the entire string is already quoted.