Newbie to windows scripting. I need help running the .bat file on the command line so I can test it.
I used Text Document as my editor to create the file (opens up also as Notepad).
I performed file “save as” (ALL FILES). If I open up cmd, I can see the file has a .txt extension (myfile.bat.txt). So if I just type in cmd myfile.bat.txt the editor opens. I am not sure how to execute this correctly.
As for the logic in my batch script, I am basically logging into a remote directory (already created the net mount) and now I want to:
- run an executeable file
- rename some files.
With some research, I written this so far. I have saved it as a .bat file
@ echo off
echo This is a batch file to run an executable and rename some files
pause
--run executable file here, just don't know how to do it
x:
cd x:
rename fileA fileB
Any help, good tips/practice would be great. Thanks.
Type in this command in cmd window:
Now you can run the script by simply invoking:
or
(provided there’s no
myfile.exeormyfile.comin the same directory).If you need to edit the script further, you can either right click it in Explorer and choose
Editor call the editor from the command window:To call a program from the script, simply add its name, if it’s in the current directory:
or the name with the path, if it’s somewhere else:
or
If the name or the path contain spaces, be sure to enclose the entire name & path string in double quotes: