+ 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
    51
    Thank Post
    33
    Thanked 2 Times in 2 Posts
    Rep Power
    7

    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
    708
    Thank Post
    77
    Thanked 159 Times in 124 Posts
    Rep Power
    49
    iexplore.exe http://URLhere

    Sorry, miss read it! - You need to add ^ before the &
    Last edited by SovietRussia; 13th September 2013 at 11: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,771
    Thank Post
    1,511
    Thanked 1,294 Times in 884 Posts
    Rep Power
    813
    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,194
    Thank Post
    81
    Thanked 263 Times in 235 Posts
    Rep Power
    79
    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
    51
    Thank Post
    33
    Thanked 2 Times in 2 Posts
    Rep Power
    7
    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.403651, -0.515458
    Posts
    9,808
    Thank Post
    262
    Thanked 2,968 Times in 2,183 Posts
    Rep Power
    847
    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
    51
    Thank Post
    33
    Thanked 2 Times in 2 Posts
    Rep Power
    7
    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

    Garacesh's Avatar
    Join Date
    Jan 2012
    Posts
    3,427
    Thank Post
    1,310
    Thanked 503 Times in 369 Posts
    Rep Power
    240
    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
    3
    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
    233
    Thank Post
    6
    Thanked 12 Times in 12 Posts
    Rep Power
    18
    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
    3
    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, 10:40 AM
  2. help with vbs script
    By sted in forum Scripts
    Replies: 14
    Last Post: 25th February 2012, 12:23 AM
  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, 03:05 PM
  4. Help with Backup Script
    By soze in forum Scripts
    Replies: 5
    Last Post: 18th June 2008, 01:12 AM
  5. Help with KIX script please
    By salan in forum Windows
    Replies: 8
    Last Post: 8th November 2007, 07: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
  •