Create an account

Very important

  • To access the important data of the forums, you must be active in each forum and especially in the leaks and database leaks section, send data and after sending the data and activity, data and important content will be opened and visible for you.
  • You will only see chat messages from people who are at or below your level.
  • More than 500,000 database leaks and millions of account leaks are waiting for you, so access and view with more activity.
  • Many important data are inactive and inaccessible for you, so open them with activity. (This will be done automatically)


Thread Rating:
  • 777 Vote(s) - 3.53 Average
  • 1
  • 2
  • 3
  • 4
  • 5
%temp% etc not working

#1
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,
Reply

#2
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"
Reply

#3
You can use [Environment]::ExpandEnvironmentVariables to expand environment variables within a string the old-fashioned way.

$s = '%systemroot%\temp'
[Environment]::ExpandEnvironmentVariables($s)
Reply

#4
**Successfully verified with below code C#.**

//**file location - User Variables**
string fileLocation = Environment.GetEnvironmentVariable("AZURE_FILE_PATH", EnvironmentVariableTarget.User);
//**file location - System Variables**
string fileLocation = Environment.GetEnvironmentVariable("AZURE_FILE_PATH", EnvironmentVariableTarget.Machine);

On Powershell script

& "D:\Visual_Studio_Workspace\AzureUpload\AzureUpload\bin\Debug\AzureUpload.exe"

AzureUpload.exe -- contain the above code C# code as Console application (Visual_Studio_Workspace\AzureUpload\AzureUpload\bin\Debug\{.exe file location})
Reply



Forum Jump:


Users browsing this thread:
1 Guest(s)

©0Day  2016 - 2023 | All Rights Reserved.  Made with    for the community. Connected through