pxlrbt / move-wsl

Easily move your WSL distros VHDX file to a new location.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Powershell Script Fails to Import

Pentiva opened this issue · comments

When I ran the powershell script it failed to import the tar file into WSL.

I believe this line is incorrect:

& cmd /c wsl --import $distro $targetFolder "`"$tempFile`"";

It looks like the backticks and quotation marks are not matched correctly (and I'm not comfortable enough with powershell to figure out the correct matching).

Hey,
did you get an error when importing the tar file? Did you have the rights to import at the location you specified?
I am not an PowerShell expert but the line looks fine. The same syntax is used for the export. The backticks are used for escaping the quotes.

Ah, I didn't realize that the backticks were escaping the quotes. The mismatch makes sense now.

Yes, the error was that the file couldn't be found (The system cannot find the file specified), but when I ran the command manually, it imported perfectly fine so I don't think it was a permission error. Unless it fails when ran from a different drive, because when manually running the command I ran it from the destination folder (cmd /c wsl --import docker-desktop-data . docker-desktop-data.tar)

@Pentiva I just looked into this. Did you enter the folder name with a trailing slash? Apparently there was an issue that the import script demands paths without trailing slash. I just released a new version.

I don't remember, but I am pretty sure I did so that would explain it. Thanks for looking into it.