+ Post New Thread
Results 1 to 11 of 11
Scripts Thread, Help with Dos script to launch explorer to a url or homepage in Coding and Web Development; Hi guys, I have a script which I run as part of a .cmd that is run to launch a ...
  1. #1

    Join Date
    Jan 2012
    Location
    Surrey
    Posts
    37
    Thank Post
    19
    Thanked 1 Time in 1 Post
    Rep Power
    0

    Question Help with Dos script to launch explorer to a url or homepage

    Hi guys,

    I have a script which I run as part of a .cmd that is run to launch a specific website in internet explorer when users logon. The problem I am having is that the url has a '&' in it which dos won't parse properly. I've been trawling the net but couldn't find a solution. I then tried to set the url i wanted as the homepage for that user via AD, but then couldn't find a way to make the script launch IE just to the homepage, it seems to need to have a url passed as an argument.

    Any help much appreciated.

    Phil

  2. #2
    SovietRussia's Avatar
    Join Date
    Mar 2013
    Location
    Powys, Wales
    Posts
    606
    Thank Post
    67
    Thanked 131 Times in 102 Posts
    Rep Power
    43
    iexplore.exe http://URLhere

    Sorry, miss read it! - You need to add ^ before the &
    Last edited by SovietRussia; 13th September 2013 at 10:55 AM.

  3. Thanks to SovietRussia from:

    Phildw (13th September 2013)

  4. #3

    LosOjos's Avatar
    Join Date
    Dec 2009
    Location
    West Midlands
    Posts
    5,446
    Thank Post
    1,438
    Thanked 1,168 Times in 797 Posts
    Rep Power
    707
    Hi @Phildw - have you tried escaping the ampersand with a caret?

    e.g:

    Code:
    Original: http://www.google.co.uk/#q=edugeek&safe=active&sout=1
    
    Escaped: http://www.google.co.uk/#q=edugeek^&safe=active^&sout=1

  5. Thanks to LosOjos from:

    Phildw (13th September 2013)

  6. #4
    jamesreedersmith's Avatar
    Join Date
    Sep 2009
    Location
    Ruskington
    Posts
    1,152
    Thank Post
    78
    Thanked 253 Times in 227 Posts
    Rep Power
    76
    Could you not just put speech marks around the URL so it takes it as absolute?

  7. #5

    Join Date
    Jan 2012
    Location
    Surrey
    Posts
    37
    Thank Post
    19
    Thanked 1 Time in 1 Post
    Rep Power
    0
    Quote Originally Posted by SovietRussia View Post
    iexplore.exe http://URLhere

    Sorry, miss read it! - You need to add ^ before the &
    Quote Originally Posted by LosOjos View Post
    Hi @Phildw - have you tried escaping the ampersand with a caret?

    e.g:

    Code:
    Original: http://www.google.co.uk/#q=edugeek&safe=active&sout=1
    
    Escaped: http://www.google.co.uk/#q=edugeek^&safe=active^&sout=1
    No I haven't, I'll try that, thanks

    Quote Originally Posted by jamesreedersmith View Post
    Could you not just put speech marks around the URL so it takes it as absolute?
    No, this breaks it unfortunately Cheers tho

  8. #6


    Join Date
    Feb 2007
    Location
    51.405546, -0.510212
    Posts
    8,754
    Thank Post
    221
    Thanked 2,627 Times in 1,937 Posts
    Rep Power
    779
    You could copy-and-paste the long URL into the Google URL shortener (goo.gl).

    Code:
    Before: http://www.google.co.uk/#q=edugeek&safe=active&sout=1
    After: http://goo.gl/AaF3rl

  9. #7

    Join Date
    Jan 2012
    Location
    Surrey
    Posts
    37
    Thank Post
    19
    Thanked 1 Time in 1 Post
    Rep Power
    0
    That worked a treat, thanks guys.

    Btw, any ideas on how to make it start up without needing an address passed to it?

  10. #8


    Join Date
    Jan 2012
    Posts
    2,570
    Thank Post
    922
    Thanked 342 Times in 263 Posts
    Rep Power
    206
    Only way I could think of would be point it at a shortcut instead. But that's just adding a step where it isn't needed

  11. #9

    Join Date
    Sep 2013
    Location
    Wyoming
    Posts
    32
    Thank Post
    2
    Thanked 5 Times in 4 Posts
    Rep Power
    2
    I had to do something very similar to this at work, and I took it in a two step approach. First I used a batch file to add the link to everyone's favorites.

    Code:
    echo [InternetShortcut] >"%userprofile%\favorites\smartmoneycommunity.url"
    echo URL=http://www.smartmoneycommunity.org/ >>"%userprofile%\favorites\smartmoneycommunity.url"
    echo IconFile=e:\Backups\smartmoneycommunity.ico  >>"%userprofile%\favorites\smartmoneycommunity.url"
    echo IconIndex=0 >>"%userprofile%\favorites\smartmoneycommunity.url"
    After that, I simply wrote a script to launch that link, and then added it to the startup folder, so it runs as soon as the computer is turned on.

    Code:
    start %userprofile%\Favorites\smartmoneycommunity.url
    Hope this helps!

    Andrew

  12. #10

    Join Date
    Feb 2007
    Posts
    196
    Thank Post
    6
    Thanked 8 Times in 8 Posts
    Rep Power
    17
    You can just run it as part of the shortcut. No need for a cmd

  13. #11

    Join Date
    Sep 2013
    Location
    Wyoming
    Posts
    32
    Thank Post
    2
    Thanked 5 Times in 4 Posts
    Rep Power
    2
    very good point... in which case you could just modify the original code to save it in \startup instead of \Favorites, and save a step. We did it this way and saved it on a public network drive, then just sent everyone a link to the file and it auto installed it. Very simple.

SHARE:
+ Post New Thread

Similar Threads

  1. Replies: 6
    Last Post: 4th March 2012, 09:40 AM
  2. help with vbs script
    By sted in forum Scripts
    Replies: 14
    Last Post: 24th February 2012, 11:23 PM
  3. Help with beginner script/batch file to rename Program File?
    By El_Nombre in forum How do you do....it?
    Replies: 3
    Last Post: 23rd June 2011, 02:05 PM
  4. Help with Backup Script
    By soze in forum Scripts
    Replies: 5
    Last Post: 18th June 2008, 12:12 AM
  5. Help with KIX script please
    By salan in forum Windows
    Replies: 8
    Last Post: 8th November 2007, 06:55 PM

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •