Z
Z
Zaper2013-03-17 11:00:14
Command line
Zaper, 2013-03-17 11:00:14

Bat script (or another way) to create a new folder when the folder name is specified in the request to the script via a link?

Friends, help me cope with the task
What is:
There is an order database (Excel document), in one of the cells there is a link to the address of the folder of a specific order (for example D: \ Base \ 122 )
The number is taken from cell A1
=ГИПЕРССЫЛКА("D:\База\"&A1; 1)
Question:
How to make it so that when you click on a link in an Excel document in the directory D: \ Base \, a folder was created with the number specified in this link.
My fantasies about this:
Put in D: \ Base \ bat-file that can create folders with the name with which it is asked, and register the link as a link to a bat-file indicating the desired name of the new folder in it, for example:
D:\База\newfolder.bat -122
Then in Excel like this:

=ГИПЕРССЫЛКА("D:\База\newfolder.bat -"&A1; 1)

With this option, the question is:
1. What to write in a bat-file?
2. What is the format of the request to write to him in the link?
Completely different approaches to the solution are also accepted, the main thing is that it works by clicking on the link

Answer the question

In order to leave comments, you need to log in

3 answer(s)
F
FilimoniC, 2013-03-17
@Zaper

@SET SOMEPREFIX_BASEDIR=K:\BASE
@MKDIR %SOMEPREFIX_BASEDIR%\%1
@IF NOT EXIST %SOMEPREFIX_BASEDIR%\%1 PING -n 10 127.0.0.1 > NUL

Call like this:
newfolder.bat 100

1) Does not support spaces in the name
2) Be careful with encoding - a common problem with BAT files.
3) If the folder is not created, hold the window for 10 seconds.
4) And, yes, VBS is prettier in this regard

A
Anton Bobylev, 2013-03-17
@dpigo

@echo off
mkdir %1

R
rPman, 2013-03-17
@rPman

Read about visual basic/javascript scripting (windows scripting host) outside and inside excel and don't write frank garbage from a pile of batch files, excels, etc. By the way, this is already an outdated method, the mainstream is powershell. And if absolutely correct, write an application in .net c#/vb#/f#/...#.
bat language is completely unsuitable for working with excell,

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question