Jump to content

copy shortcut to quick launch fails?


Recommended Posts

during the RunOnceEx.cmd i try to copy some shortcuts to quick launch folder so that they will appear in the quick launck after reboot ..but it fails !!

i use a cmd file to do the copy.

when i try it on my development PC it works fine but will always fail when i run in during my RunOnceEx.cmd.

can anyone help?

Link to comment
Share on other sites


A good idea is to post your script :)

I copy in the QuickLaunch shortcuts during cmdlines.txt:

rem Kopier genveje til QuickLaunch
call md "%AllUsersProfile%\..\Default User\Application Data\Microsoft\Internet Explorer\Quick Launch\"
call copy /Y "%systemdrive%\install\applications\quicklaunch\*.lnk" "%AllUsersProfile%\..\Default User\Application Data\Microsoft\Internet Explorer\Quick Launch\"

Edited by druiddk
Link to comment
Share on other sites

heres a one I use this may help. This copy the windows explorer shortcut

set UserQL=%UserProfile%\Application Data\Microsoft\Internet Explorer\Quick Launch

REM ::::::::::::::::::::::::
REM :::: Quick Launch :::
REM ::::::::::::::::::::::::

REM :: Create / Copy New Shortcuts ::
COPY /Y "%%UserProfile%\Start Menu\Programs%\Accessories\Windows Explorer.lnk" "%UserQL%"

Link to comment
Share on other sites

If you open a command prompt and

cd %AppData%\Microsoft\Internet Explorer\Quick Launch\
dir

Do you then see the shortcut there?

Can you see the QuickLaunch bar before copying the shortcut?

@Glent: Why do you use %UserProfile% instead of skipping directly to %AppData%?

Link to comment
Share on other sites

i created an sfx with the same code and works fine.

all other still wont work..this code will always work as long as it is not in ran at startup.

i pause the cmd file and found that the error was:

the path c:\document was not found

Link to comment
Share on other sites

@hamohd70:

Ahh... when you specify paths with spaces in for example:

c:\documents and settings\blah\blah

Then you need to use " " to avoid the spaces:

"c:\documents and settings\blah\blah"

Edited by druiddk
Link to comment
Share on other sites

If sounds as if you are not running the batch file from the same directory as the location of the .lnk file. In the case of the self-extracting EXE method you say works, the code will be running from the same location.

Either

  • CD to that location first or PUSHD and POPD

or

  • use the full path

COPY X:\PATH_TO\Picasa2.lnk "%AppData%\Microsoft\Internet Explorer\Quick Launch"

Edited by Yzöwl
Link to comment
Share on other sites

Here is a example vbs script that copies to the quick launch.

1:\ Make A Text File

2:\ Copies The Text File To Quick Launch

3:\ Checks To See if It Copy to Quick Launch

4:\ Run The Made Text File If It Found If

Not Found A Message Box Will Appear.

5:\ It Then Check For The Text Files Then

delets the text files.

Save This As WHATEVER_YOU_WANT.VBS

Dim Fso, QL, Ts '''' VARIBLES FOR THE SCRIPT

QL = CreateObject("Wscript.shell").ExpandEnvironmentStrings("%Appdata%\Microsoft\Internet Explorer\Quick Launch\")

Set Fso = CreateObject("Scripting.FileSystemObject")

Set Ts = Fso.CreateTextFile("ScriptLog.txt")

Ts.WriteLine Time() & " < ----- Time and date ----- > " & Date() & vbcrlf & " < ----- Start The Copy ----- > "

Ts.WriteLine (CreateObject("Wscript.shell").CurrentDirectory) & Vbcrlf & " < ----- End Of The Copy ----- > " & vbCrLf & QL

Ts.Close ''''FILE TO COPY '''' WHERE THE FILE GOES TO

Fso.CopyFile ("ScriptLog.txt") , (QL), OverwriteExisting

'''' THIS LINE TO SEE IF THE COPY MADE IT TO THE QUICK LAUNCH

If Fso.FileExists(QL & "ScriptLog.txt") Then

CreateObject("Wscript.shell").Run(Chr(34) & QL & "ScriptLog.txt" & Chr(34)),Normal,True

Else '''' ERROR CONTROL IF THE FILE IS NOT FOUND

CreateObject("Wscript.shell").Popup "The Text File Was Not Made Or" & vbCrLf & "Was Not Found At This Location" &_

vbCrLf & UCase(CreateObject("Wscript.shell").CurrentDirectory), 15,"Error No File Found....", 0 + 48

End IF

''''CHECKS THEN DELETE THE TEST FILES

If Fso.FileExists("ScriptLog.txt") Then Fso.DeleteFile("ScriptLog.txt") End If

If Fso.FileExists(QL & "ScriptLog.txt") Then Fso.DeleteFile(QL & "ScriptLog.txt") End If

Here Is A 2 Line VBS File That Copies To The Quick Launch

Then It Deletes The Source Files.

Save File As COPY_WHATEVER.VBS

This Text Color Is The Name Of File To Copy Replace

With Your File Name. This Is Set To Run In The Same Directory. You

Can Add A Full Path to The file Also Exaple

C:\Install\MyShortcuts\Name_Of_File

On Error Resume Next : Const OverwriteExisting = True, Normal = 1 : Dim Fso, QL, Ts : QL = CreateObject("Wscript.shell").ExpandEnvironmentStrings("%Appdata%\Microsoft\Internet Explorer\Quick Launch\")

Set Fso = CreateObject("Scripting.FileSystemObject") : Fso.CopyFile ("TestScript.txt") , (QL), OverwriteExisting : If Fso.FileExists("TestScript.txt") Then Fso.DeleteFile("TestScript.txt")End If

Edited by gunsmokingman
Link to comment
Share on other sites

shortcut and cmd file are both in the same path !

Doesn't matter. As Yzowl stated and druiddk demonstrated, you need the full path on both ends, to locate the source and destination. From my WPI:

SET shortcuts=%cdrom%\Programs\00Shortcuts

COPY "%shortcuts%\Windows Explorer.lnk" "%systemdrive%\Documents and Settings\USER_HERE\Application Data\Microsoft\Internet Explorer\Quick Launch"

And, yeah, the path could be shorter. :P

Link to comment
Share on other sites

I usually create the shortcuts when I install an application so I'm not sure if this is going to do what you want to. There is a program shortcut.exe which lets you create shortcuts from the command line. Note this program will create shortcuts even if the destination file doesn't exist so it can be used to create shortcuts before an application is installed.

Example: script that installed autoruns (www.sysinternals.com) and creates a shortcut.

@echo off

set dest=%~1

if "%dest%"=="" set dest=C:\Program Files\Admin\SysInternals\autoruns

if not exist "%dest%" md "%dest%"

unzip -o "%~dp0autoruns.zip" -d "%dest%"

if not exist "%ALLUSERSPROFILE%\Start Menu\Programs\Admin\SysInternals" md "%ALLUSERSPROFILE%\Start Menu\Programs\Admin\SysInternals"

"%~dp0..\shortcut.exe" /F:"%ALLUSERSPROFILE%\Start Menu\Programs\Admin\SysInternals\Autoruns.lnk" /A:C /T:"%dest%\autoruns.exe" /W:"%dest%"

If the example above shortcut.exe is located in the parent folder. You could put it in your $OEM$\$$\System32 folder and then call it directly. The program also uses unzip.exe which is part of unz552xN.exe. I use this command so much that I've included it in my $OEM$\$$\System32 so I know it will always be available.

The example script is fairly simple. I want to be able to specify where to uncompress the archive but have a default if I don't specify the path. %~1 is the first parameter passed to the script with the surrounding quotes removed. %~dp0 expands to the path of the batchfile.

To create a shortcut on the Quick Launch bar use the following (assuming that shortcut.exe is in you path)

shortcut.exe /F:"%APPDATA%\Microsoft\Internet Explorer\Quick Launch\Autoruns.lnk" /A:C /T:"%dest%\autoruns.exe" /W:"%dest%"

Link to comment
Share on other sites

Instead of having a batch file run during Runonceex.cmd, how about just copying the icon shortcuts to the following folder...

Unattended CD Location\$OEM$\$Docs\Default User\Application Data\Microsoft\Internet Explorer\Quick Launch

I put all my quicklanuch icons there, works everytime.

Link to comment
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
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...