Copy folders with CMD space

Asked

Viewed 2,393 times

2

Óla would like to know how to copy a folder named with space in the CMD, but the command is in double quotes and it does not accept other double quotes inside, for example, I tried the following ways and none of them worked, can anyone help me? Thank you

@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

1 answer

3


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

Example:

Folders:

Program Files
Program Files (x86)

In CMD, they will be respectively:

Progra~1
Progra~2

So the path to your folder will be:

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

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

dir /X

Upshot:

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
  • 3

    our face worked, very much THANK YOU :)

Browser other questions tagged

You are not signed in. Login or sign up in order to post.