Link to home
Start Free TrialLog in
Avatar of mhamer
mhamer

asked on

open folder in powershell

hi, id like a powershell script to open a location

eg

when run the folder c:\data\test\%hostname%\tools    opens  much like if there was a shortcut to it


power shell preffered VB ok
Avatar of Meir Rivkin
Meir Rivkin
Flag of Israel image

use Invoke-item:invoke-item c:\data\test\%hostname%\tools
ASKER CERTIFIED SOLUTION
Avatar of Meir Rivkin
Meir Rivkin
Flag of Israel image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of mhamer
mhamer

ASKER

Great works perfectly thank you

what would be the vb equivilant?  just out of interest?  you get the points anyway
in vb script:


Set objShell = CreateObject("WScript.Shell")
hostname = objShell.ExpandEnvironmentStrings("%hostname%")
objShell.Run "explorer c:\data\test\" & hostname & "\tools

Open in new window

Avatar of mhamer

ASKER

unterminated string constant  when i use that
i forgot the " in line 3:

Set objShell = CreateObject("WScript.Shell")
hostname = objShell.ExpandEnvironmentStrings("%hostname%")
objShell.Run "explorer c:\data\test\" & hostname & "\tools"