D
D
DenJel2015-09-09 17:11:58
Programming
DenJel, 2015-09-09 17:11:58

Passing parameters and calling from console bat file?

I need the Bat file to generate the structure of files and folders in the directory where you are in the console. First, as I understand it, you need to throw it in PATH and you can call it anywhere.
How to pass a variable to it from the console. How do I call it from the console. And the main thing is that it generates files and folders not in the directory where it is located, but in the directory where it is called from.
I know I explained it very stupidly, but you probably get the point))

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
Alexey Shumkin, 2015-09-09
@DenJel

The batch file can be called by its full path, regardless of where it lies,
simply by name - yes, if it is in PATH.
for example, such a bat-nickname, let's call it example.bat and save it to c:\Temp\:

dir
echo %1
echo %2
echo %3
echo %*

at startup
c:\Temp\example.bat "первый параметр" второй параметр
will output the contents of the current directory and the
type parameters passed in
Том в устройстве D имеет метку Data
 Серийный номер тома: ...

 Содержимое папки d:\

09.09.2015  17:46                 0 1
07.07.2015  16:17    <DIR>          ...
05.11.2014  17:56    <DIR>          ...
28.07.2014  16:02    <DIR>          ...
10.09.2014  19:18        13 234 918 ...
...
               6 файлов     37 073 021 байт
              27 папок   2 091 204 608 байт свободно
первый параметр
второй
параметр
первый параметр второй параметр

%1, %2, ... here, as Alexander Taratin already said - parameters,
%* - all parameters
stackoverflow.com/questions/26551/how-to-pass-comm...
https://en.wikibooks. org/wiki/Windows_Batch_Scripting

O
onlooked, 2015-09-09
@onlooked

the sky needs the tree command?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question