You can change .net working dir to powershell working dir:
[Environment]::CurrentDirectory = (Get-Location -PSProvider FileSystem).ProviderPath
After this line all .net methods like [io.path]::GetFullPath
and [IO.File]::WriteAllText
will work without problems
More Related Contents:
- this code my teacher gave it to us as homework and it does not work with me idk why
- How can you use an object’s property in a double-quoted string?
- Powershell: passing json string to curl
- How to escape special characters in PowerShell?
- How can I replace every occurrence of a String in a file with PowerShell?
- Function return value in PowerShell
- Loop through files in a directory using PowerShell
- how do I loop through a line from a csv file in powershell
- Access PSObject property indirectly with variable
- Is there a way to set a variable up to place output to stdout or null?
- Custom RoboCopy Progress Bar in PowerShell
- Executing an EXE file using a PowerShell script
- Difference between ForEach and ForEach-Object in powershell
- How to reference .NET assemblies using PowerShell
- Any way to double-click on .PS1 file & open them in PowerShell?
- How to properly -filter multiple strings in a PowerShell copy script
- Methods to hex edit binary files via Powershell
- Unable to convert a string to an integer variable from DateTaken attribute on a JPG file
- How to Grant permission to user on Certificate private key using powershell?
- Using Invoke-Command -ScriptBlock on a function with arguments
- Powershell – Reboot and Continue Script
- Hashtables and key order
- How can I execute an external program with parameters in PowerShell?
- Should $null be on the left side of the equality comparison? (-eq with arrays)
- Does PowerShell support HashTable Serialization?
- Check if a file exists or not in Windows PowerShell?
- Variable scoping in PowerShell
- Read a Csv file with powershell and capture corresponding data
- PS Script is exporting an empty CSVs
- Drag and Drop to a Powershell script