Copy of folders with CMD space

0

Hello, I want to know how to copy a folder named with space in the CMD, but the command is inside double quotation marks and it does not accept another double quote inside, for example, I tried the following ways and none of them worked, Can someone help me? Thanks

@echo off
SET var=C:\Users\MIKAEL\Downloads\'programs teste'\cpu-z_1.80-en.zip
runas /user:%usuario% "CMD /C title NETProxy & copy %var% C:\Users\Public\Desktop\ /y & start c:\Users\Public\Desktop\cpu-z_1.80-en.zip" > null

@echo off
SET var=C:\Users\MIKAEL\Downloads\"programs teste"\cpu-z_1.80-en.zip
runas /user:%usuario% "CMD /C title NETProxy & copy %var% C:\Users\Public\Desktop\ /y & start c:\Users\Public\Desktop\cpu-z_1.80-en.zip" > null

@echo off
SET var="C:\Users\MIKAEL\Downloads\programs teste\cpu-z_1.80-en.zip"
runas /user:%usuario% "CMD /C title NETProxy & copy %var% C:\Users\Public\Desktop\ /y & start c:\Users\Public\Desktop\cpu-z_1.80-en.zip" > null

@echo off
runas /user:%usuario% "CMD /C title NETProxy & copy "C:\Users\MIKAEL\Downloads\'programs teste'\cpu-z_1.80-en.zip" C:\Users\Public\Desktop\ /y & start c:\Users\Public\Desktop\cpu-z_1.80-en.zip" > null

@echo off
runas /user:%usuario% "CMD /C title NETProxy & copy "C:\Users\MIKAEL\Downloads\"programs teste"\cpu-z_1.80-en.zip" C:\Users\Public\Desktop\ /y & start c:\Users\Public\Desktop\cpu-z_1.80-en.zip" > null

@echo off
runas /user:%usuario% "CMD /C title NETProxy & copy "C:\Users\MIKAEL\Downloads\programs teste\cpu-z_1.80-en.zip" C:\Users\Public\Desktop\ /y & start c:\Users\Public\Desktop\cpu-z_1.80-en.zip" > null
    
asked by anonymous 15.01.2018 / 22:17

1 answer

1

Every folder / file by command prompt has a short name, which is always 6 'letters' + '~' + number in alphabetical order.

Example:

Folders:

Program Files
Program Files (x86)

In the CMD, they will be respectively:

Progra~1
Progra~2

Soon, the path of your folder will be:

C:\Users\MIKAEL\Downloads\progra~1\cpu-z_1.80-en.zip
  

To list all the directories of a folder, showing the short names, at the command prompt type:

dir /X

Result:

14/07/2017  23:44    <DIR>                       Intel
22/08/2013  13:22    <DIR>                       PerfLogs
03/08/2017  22:09    <DIR>          PLATAF~1     PlataformaTISS
03/11/2017  19:39    <DIR>          PROGRA~1     Program Files
15/11/2017  22:56    <DIR>          PROGRA~2     Program Files (x86)
14/07/2017  22:19                 0              Recovery.txt
14/07/2017  23:29    <DIR>                       Users
08/01/2018  23:50    <DIR>                       Windows
15/10/2017  23:29    <DIR>                       Xamarin
02/09/2017  02:10    <DIR>                       xampp
    
15.01.2018 / 22:21