The following is the step by step instruction to copy file(s) from Ubuntu to Windows 10 using the WSL windows feature. Assuming that you have WSL and Ubuntu installed in your windows 10 machine.
1. Open up a command prompt with admin privilege.
2. Type "wsl" to enter the Ubuntu default Linux system.
3. use the following command to copy file:
cp UBUNTU_FILES_OR_DIR WINDOWS10_DIR -r
example: cp opencv-4.0.0/build/CMakeFiles /mnt/c/Temp -r
From the example, notice the use of /mnt to access to Windows 10 file system. "c" means c drive.
Sunday, June 23, 2019
Tip: For guaranteed network drive map/access using "Net Use"
The following script can be used to map a network drive or to access a folder in a network drive such as NASH or File Server
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
set LoginAccount=USERNAME | |
REM Replace USERNAME by your username | |
set LoginPasswd=PASSWD | |
REM Replace PASSWD by your password | |
set ShareServer=SERVERIP | |
REM Replace SERVERIP by your server's IP or DNS Name. E.g 192.168.1.100\Folder1 | |
REM | |
REM Check if Credential of target Server Exsit | |
cmdkey /list:%ShareServer% | findstr /N ^^ | findstr /V "^[1-2]:" | findstr /I /C:" %ShareServer%" >nul | |
if '%errorlevel%' NEQ '0' ( | |
REM Non Credential of target Server Exsit | |
REM Do nothing | |
) else ( | |
REM Credential of target Server Exsit | |
REM Delete the Credential | |
cmdkey /delete:%ShareServer% | |
) | |
REM Add new Credential | |
REM You can found the new Credential in "Control Panel -> Credential Manager" | |
cmdkey /add:%ShareServer% /user:%COMPUTERNAME%\%LoginAccount% /pass:%LoginPasswd% | |
REM Delete All cached Credentials of target Server | |
net use \\%ShareServer% /delete /Y | |
REM Set Relative Services Start Type to Auto | |
sc config LanmanWorkstation start=auto >NUL 2>&1 | |
sc config lmhosts start=auto >NUL 2>&1 | |
sc config netlogon start=auto >NUL 2>&1 | |
sc config sessionenv start=auto >NUL 2>&1 | |
sc config Browser start=auto >NUL 2>&1 | |
REM Restart Relative Services by Powershell | |
powershell -inputformat none -outputformat none -NonInteractive -Command "Restart-Service LanmanWorkstation,lmhosts -Force" | |
REM Make new connection | |
net use \\%ShareServer% "%LoginPasswd%" /user:"%COMPUTERNAME%\%LoginAccount%" | |
REM Open shared folder on Explorer | |
explorer \\%ShareServer% |
Subscribe to:
Posts (Atom)