Xp batch file reference




















I'm trying to write a batch file to xcopy a folder to a removable USB drive. The problem that I face, however, is that drive letters are subject to change, so I would like to be able to do this by referencing the volume label instead of the drive letter. This command should discover the drive with the correct label and store the drive letter with colon in variable "usb". You could embed your xcopy command s directly in the DO clause if you like.

How are we doing? Please help us improve Stack Overflow. Take our short survey. Stack Overflow for Teams — Collaborate and share knowledge with a private group. Create a free Team What is Teams? Collectives on Stack Overflow. Learn more. Asked 9 years, 11 months ago. Active 5 years, 9 months ago. Viewed 19k times. Any ideas? An hour of Google-ing has proved fruitless. Now that we have a list of batch file commands, we can also view details of their syntax and functionalities in following way:.

The batch command LABEL displays the label of a drive or volume and is also is used for adding, setting or removing a disk label. Now this will display the label of your working directory and you can set, remove or add another label.

So, it will generate following output:. This batch command moves files from one directory to another, rename the directories and move the directories as well. In this way, MOVE command can be used to move files, directories and rename directories. The batch command NET is used for many network functionalities depending upon the commands used. The batch command PATH displays the path variable or it can be used to set path variable. The batch command PAUSE is used for holding the output screen till user enters a variable or a value.

The batch command RD is used for removing the empty directories, directories with contents or files inside cannot be removed with RD command. Anything written after REM is interpreted as a comment and is not executed in batch programs.

This script will sort the content of example. This program will start the application paint if it is in the working location, else you will have to explicitly indicate the path of that program as well.

Thus the output console will look like:. The batch command TREE displays the tree diagram of the subdirectories to the last level. Active 4 years ago. Viewed 14k times. Improve this question. Add a comment. Active Oldest Votes. Improve this answer. WerkkreW WerkkreW 5, 3 3 gold badges 21 21 silver badges 31 31 bronze badges.

John Hunt 2 2 gold badges 10 10 silver badges 20 20 bronze badges. The best way to determine the location of My Documents is from the Windows Registry.

You smoked me on this answer! Proof that time spent in chat rooms during college was worth it Alexander Taran Alexander Taran 2 2 silver badges 6 6 bronze badges. This looks like you want it to be a script? This did not work for me because the Documents folder is redirected in my profile. The registry way works in that case. Sign up or log in Sign up using Google.

Sign up using Facebook. Sign up using Email and Password.



0コメント