Jump to content


Photo

Unable to create a FileShortcut! Please Help!


  • Please log in to reply
16 replies to this topic

#1 SKAN

SKAN
  • Administrators
  • 9063 posts

Posted 31 August 2006 - 09:15 AM

I am unable to create a FileShortcut for Console!

FileCreateShortcut, cmd.exe, con.lnk
If errorlevel
   MsgBox, Error

Can anbody help?!

Just for fun .. :wink:

Regards, :)

#2 majkinetor

majkinetor
  • Fellows
  • 4511 posts

Posted 31 August 2006 - 09:32 AM

FileCreateShortcut, cmd.exe, %A_Desktop%\My Shortcut.lnk

#3 SKAN

SKAN
  • Administrators
  • 9063 posts

Posted 31 August 2006 - 09:51 AM

FileCreateShortcut, cmd.exe, %A_Desktop%\My Shortcut.lnk


er... It does not work! :(

FileCreateShortcut, cmd.exe, %A_Desktop%\con.lnk
If errorlevel
   MsgBox, Error


#4 toralf

toralf
  • Fellows
  • 3948 posts

Posted 31 August 2006 - 10:04 AM

Please test
FileCreateShortcut, %comspec%, con.lnk


#5 SKAN

SKAN
  • Administrators
  • 9063 posts

Posted 31 August 2006 - 10:20 AM

Dear toralf, :)

FileCreateShortcut, %comspec%, con.lnk

No! It does not work! .. and I have sent you a Private Message .. Please check it.

Regards, :)

#6 PhiLho

PhiLho
  • Fellows
  • 6850 posts

Posted 31 August 2006 - 10:26 AM

FileCreateShortcut, cmd.exe, %A_Desktop%\con.lnk

If errorlevel

   MsgBox, Error

worked for me, on WinXP Pro SP2. You have Win2k, right?

#7 SKAN

SKAN
  • Administrators
  • 9063 posts

Posted 31 August 2006 - 10:28 AM

worked for me, on WinXP Pro SP2. You have Win2k, right?


Really! :shock: .. allow me time .. I will check it!

Regards, :)

#8 SKAN

SKAN
  • Administrators
  • 9063 posts

Posted 31 August 2006 - 10:35 AM

FileCreateShortcut, cmd.exe, %A_Desktop%\con.lnk 
If errorlevel 
   MsgBox, Error

:( I confirm .. the above code does not work in Win XP Pro & Win 2000.
Anybody using Win 98 SE? Can you check this out?

Regards, :)

#9 polyethene

polyethene

    Administrator

  • Administrators
  • 5474 posts

Posted 31 August 2006 - 11:05 AM

Can you get FileCreateShortcut to work with other files and executables? Try:
FileCreateShortcut, %ComSpec%, %A_Temp%\cmd.lnk

I know you wanted shortcuts but you can use batch files and internet shortcuts too:
FileAppend, start %ComSpec%, %A_Temp%\cmd.bat
IniWrite, %ComSpec%, %A_Temp%\cmd.url, InternetShortcut, URL


#10 SKAN

SKAN
  • Administrators
  • 9063 posts

Posted 31 August 2006 - 11:09 AM

This works! :D

FileCreateShortcut, %ComSpec%, %A_Temp%\cmd.lnk
If errorlevel
   MsgBox, Error

This does not work for me! :(

FileCreateShortcut, %ComSpec%, %A_Temp%\con.lnk
If errorlevel
   MsgBox, Error

Regards, :)

#11 majkinetor

majkinetor
  • Fellows
  • 4511 posts

Posted 31 August 2006 - 11:11 AM

Ok, this works :)

just copy paste

FileCreateShortcut, %ComSpec%, conĀ .lnk
If errorlevel 
   MsgBox, Error


#12 PhiLho

PhiLho
  • Fellows
  • 6850 posts

Posted 31 August 2006 - 11:53 AM

Oh, actually, when I tested, I renamed the target file to cmd.lnk...
The problem is that con, like prn, com and perhaps some other, are Dos-reserved words for peripherals: console, printer, serial communication port... So you cannot create files with these names!
Type, on the command line, the command: copy C:\boot.ini con (or some other existing file)...

#13 majkinetor

majkinetor
  • Fellows
  • 4511 posts

Posted 31 August 2006 - 12:00 PM

or some other existing file

or nonexisting...

#14 SKAN

SKAN
  • Administrators
  • 9063 posts

Posted 31 August 2006 - 12:07 PM

Wow! That shows your experience.

Oh, actually, when I tested, I renamed the target file to cmd.lnk


You actually gave me a fright and I had to boot into XP. :lol:

Can anbody help?!

Just for fun .. :wink:


I have already apologised ( Private Messages ) to everyone who replied .. except you! ( You will take a month to read it! :D )
I was thinking of mailing .. but you have already answered!

Thank you ...

Nothing of these would work:

CON PRN LPTn COMn NUL ( Did I miss something ? )

Regards, :)

PS: I guess this topic should go to General Chat .. as Titan suggested !

#15 polyethene

polyethene

    Administrator

  • Administrators
  • 5474 posts

Posted 31 August 2006 - 12:30 PM

The problem is that con, like prn, com and perhaps some other, are Dos-reserved words for peripherals

It would be helpful if Chris mentioned this in the somewhere in the manual or atleast set ErrorLevel to 1 when files like this are made.