How To Get Desktop Path Dynamically In QTP or UFT?

0
50
Spread the love
  • 1
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  
    1
    Share

In my initial days with QTP, frequently I needed to download somefile to upload or download from or to the desktop.
To be in safe side I always used a Environment variable which carried the value of the Desktop path.

Like –Environment(“Desktop”).value= “path of the machine”

So in every release I use to tag this script as needs update during rerun in different machine.

Later I found a nice solution to find out the desktop path dynamically.

Set WSHShell = CreateObject("WScript.Shell")
strShortcutLoc = WSHShell.SpecialFolders("Desktop")

This is a Tested code which can be used to any machine. My problem resolved.

Don't miss out!
Subscribe To Newsletter

Receive top technical news, lesson ideas, travel tips and more!

Invalid email address
Give it a try. You can unsubscribe at any time.

Spread the love
  • 1
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  
    1
    Share

LEAVE A REPLY

Please enter your comment!
Please enter your name here