Showing posts with label dos cmd. Show all posts
Showing posts with label dos cmd. Show all posts

Thursday, July 28, 2016

back slash *\* or forward slash */*



[windows/dos command]

[abstract]
in that the DOS commands only accept back slash '\' in a path string,
so before commands executed, the path string should be disposed.


[]
to replace '\\' to '/'
     
     #include <algorithm>
     std::string backslashPath = "D:\\imDirectory\\imFile.ext";
     std::replace(backslashPath.begin(), backslashPath.end, '\\','/');

to replace '/' with '\\'

     #include <algorithm>
     std::string forwardslashPath = "D:/imDirectory/imFile.ext";
     std::replace(forwardslashPath.begin(), forwardslashPath.end(), '/','\\');


Done :-)
End :-)
__________

[CN]无效开关 - // [EN] Invalid switch - - /x


How to repeat the error ?
______________________________
<>
windows7 64bit
Dos Command Line Interaction
<>
cmd
   DEL /F D:/filenameTObeDeleted.ext

> 无效开关 - "filenameTObeDeleted.ext"
____________________________________


RESOLUTION:




....
....
SYMPTOMS
When you use switches with the xcopy or xcopy32 commands in MS-DOS mode after having chosen Command Prompt Only at the boot menu, or at a command prompt while using the Windows Millennium Edition (Me) Emergency Boot Disk (EBD), you may receive the following error message
Invalid switch - - /x
where x is the switch used, such as /H.
CAUSE
This behavior occurs when you use an unsupported switch with the xcopy or xcopy32 command. In the scenarios that are mentioned in the "Symptoms" section in this article, these commands support only a limited subset of switches.
RESOLUTION
To resolve this behavior, use only the supported switches when Windows starts. The supported switches are listed in the "More Information" section in this article.
MORE INFORMATION

Supported Switches

SwitchDefinition
/cContinues copying even if errors occur.
/iIf a destination does not exist while copying more than one file, this switch assumes that the destination must be a directory.
/qDoes not display file names while copying.
/fDisplays full source and destination file names while copying.
/lDisplays files that would be copied.
/hCopies all files including hidden and system files. 
Note: This switch is only supported at the command prompt in Windows Me.
/rOverwrites read-only files.
/tCreates directory structure, but does not copy files. Does not include empty directories or subdirectories.
/uUpdates the files that already exist in destination.
/kCopies attributes. Normal xcopy will reset read-only attributes.
/yOverwrites existing files without prompting.
/-yPrompts you before overwriting existing files.
/nCopies by using the generated short names.


For a complete listing of switches that are available for xcopy and xcopy32, refer to the following article:
289483 Switches That You Can Use with Xcopy and Xcopy32 Commands

>Done :-)
>End :-)
___________

Thursday, July 21, 2016

CLI DOS: del /?

How to Delete a File in Windows from the Command Prompt







________________
Here's How:
1. Do step 2, 3, or 4 for how you would like to delete your file(s).

2. To Use an Elevated Command Prompt in Windows
NOTE: This will allow you to delete any file(s) on the computer.
A) Open Folder Options, uncheck the Hide extensions for known file types box, and click on OK. (see screenshot below)
Name:  Folder_Options.jpg
Views: 507068
Size:  138.0 KB
B) Open an Elevated command prompt in Vista/Windows 7 or Windows 8, and go to step 5 below. 
3. To Use a Command Prompt in Windows
NOTE: This will only allow you to delete any file(s) in your user folders.
A) Open Folder Options, uncheck the Hide extensions for known file types box, and click on OK. (see screenshot below)
Name:  Folder_Options.jpg
Views: 507068
Size:  138.0 KB
B) Open a command prompt in Vista/Windows 7 or Windows 8, and go to step 5 below.
4. To Use a Command Prompt at Boot
NOTE: This will allow you to delete any file(s) on the computer.
A) Open a command prompt at boot in Vista/Windows 7 or Windows 8.

B) In the command prompt, type diskpart and press Enter. (see screenshot below)

C) In the command prompt, type list volume and press Enter. (see screenshot below)
NOTE: This will let you see what the drive letter is for the drive that you want to delete the file in since it may not always be the same drive letter that it is in Windows.

D) After making note of the drive letter, type exit, press Enter, and go to step 5 below. (see screenshot below)
-command-1.jpg
5. Do step 6, 7, 8, 9, or 10 for how you would like to delete your file(s).


6. To Delete a Specific File in Command Prompt
A) In the command prompt, type the command below, press Enter, and go to step 11 below.

NOTE: Substitute Full Path of File with extension within quotes below with your files's full path and name with the extension included within quotes instead.

Code:
DEL /F /S /Q /A "Full Path of File with extension"
NOTE: For example, if I wanted to delete a text file named File with the file extension .txt on my desktop, I would type this command below.

Code:
DEL /F /S /Q /A "C:\Users\UserName\Desktop\File.txt"
7. To Delete All Files in a Folder without Confirmation in Command Prompt
NOTE: This will not ask you if it's ok (Y/N) to delete each file when deleting all files in a folder and the folder's subfolders.
A) In the command prompt, type the command below, press Enter, and go to step 11 below.

NOTE: Substitute Full Path of Folder within quotes below with the full path of the folder that you want to delete all files in.

Code:
DEL /F /S /Q /A "Full Path of Folder\*"
NOTE: For example, if I wanted to delete all files in my D:\Projects folder and subfolders, I would type this command below.

Code:
DEL /F /S /Q /A "D:\Projects\*"
8. To Delete All Files in a Folder with Confirmation in Command Prompt
NOTE: This will ask you if it's ok (Y/N) to delete each file when deleting all files in a folder and the folder's subfolders.
A) In the command prompt, type the command below, press Enter, and go to step 11 below.

NOTE: Substitute Full Path of Folder within quotes below with the full path of the folder that you want to delete all files in.

Code:
DEL /P /F /S /A "Full Path of Folder\*"
NOTE: For example, if I wanted to delete all files in my D:\Projects folder and subfolders, I would type this command below.

Code:
DEL /P /F /S /A "D:\Projects\*"
9. To Delete All Files with a Specified File Extension in a Folder without Confirmation in Command Prompt
NOTE: This will not ask you if it's ok (Y/N) to delete each file when deleting all files with a specified file extension in a folder and the folder's subfolders.
A) In the command prompt, type the command below, press Enter, and go to step 11 below.

NOTE: Substitute Full Path of Folder within quotes below with the full path of the folder that you want to delete all files in. Substitute extension with the file extension of the type of files that you want to delete in the folder and it's subfolders.

Code:
DEL /F /S /Q /A "Full Path of Folder\*.extension"
NOTE: For example, if I wanted to delete all txt (text) files in my D:\Projects folder and subfolders, I would type this command below.

Code:
DEL /F /S /Q /A "D:\Projects\*.txt"
10. To Delete All Files with a Specified File Extension in a Folder with Confirmation in Command Prompt
NOTE: This will ask you if it's ok (Y/N) to delete each file when deleting all files with a specified file extension in a folder and the folder's subfolders.
A) In the command prompt, type the command below, press Enter, and go to step 11 below.

NOTE: Substitute Full Path of Folder within quotes below with the full path of the folder that you want to delete all files in. Substitute extension with the file extension of the type of files that you want to delete in the folder and it's subfolders.

Code:
DEL /P /F /S /A "Full Path of Folder\*.extension"
NOTE: For example, if I wanted to delete all txt (text) files in my D:\Projects folder and subfolders, I would type this command below.

Code:
DEL /P /F /S /A "D:\Projects\*.txt"
11. The file(s) should now be deleted.

12. Close the command prompt.
NOTE: If you used a command prompt at boot, then also close the System Recovery Options window and restart the computer.
That's it,
Shawn



________
Done:-)
End
______________

Monday, July 18, 2016

xcopy DOS cmd


Cited URL



xcopy file, rename, suppress “Does xxx specify a file name…” message



SOLUTION1.(from stackoverflow)

There is some sort of undocumented feature in XCOPY. you can use:
xcopy "bin\development\whee.config.example" "c:\mybackup\TestConnectionExternal\bin\Debug\whee.config*"

SOLUTION2.(anthor way)

sFullPath= "D:\mVS2013\mVS2013Project\_mTest\_bin\data\texture\map\1.png"
dFullPath= "E:\mNonExistence\CreateMeFirst\1.png"

XCOPY D:\cvx\engine_dev\Samples\MSNZS\client_mobile\AppMain\bin-debug\uiimg\chapter\1.png  E:\_mTest\ResCom\uiimage\chapter\* /i