Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

%temp% etc not working

Tags:

powershell

I have the below that is used as a batch file that launches powershell (too long to go over but it is used in another script).

Anyway, I noticed the %systemroot%\temp and %systemroot% does not work.

Any idea how I can fix this?

%systemroot%\system32\WindowsPowerShell\v1.0\powershell.exe -ExecutionPolicy Unrestricted -File %SystemRoot%\TEMP\ROFS\testing_script_log.ps1 

Thanks,

like image 528
lara400 Avatar asked Nov 08 '11 13:11

lara400


1 Answers

If you are executing that line from PowerShell rather than from CMD, you can use the PowerShell environment variable syntax:

PS C:\> & "$env:SystemRoot\System32\WindowsPowerShell\v1.0\powershell.exe" 
like image 198
Eric Nicholson Avatar answered Sep 24 '22 19:09

Eric Nicholson