Calling file inside script folder in PowerShell -
i have powershell script in \folder\ have exe trying execute \folder\files\
how can execute file without having specify whole path , use either current folder drill down files.
i trying use not working
start-process -filepath '.\files\setup.exe' -argumentlist "-s" -wait
the $psscriptroot
variable see right if you're using powershell 3 or newer. in version 2 variable work within modules, , i'm not sure version 1 (before time.)
$psscriptroot
gives path of directory in script saved (not full path including file name don't need worry splitting out.)
for specific example:
start-process -filepath "$psscriptroot\files\setup.exe" -argumentlist "-s" -wait
Comments
Post a Comment