Bat.file folderpath - making it dynamic

Razzy

Board Regular
Joined
Jul 24, 2020
Messages
61
Office Version
365
Platform
Windows
This works:
VBA Code:
cscript script.vbs "C:\Users\%username%\Documents\Script\Makro.xlsm"
How can I get the folder path where the bat-file is? Something like:

VBA Code:
set batdir= %~dp0 

cscript script.vbs batdir & "Makro.xlsm"
Can anyone spot my typo? :unsure:
 

Some videos you may like

Excel Facts

How to fill five years of quarters?
Type 1Q-2023 in a cell. Grab the fill handle and drag down or right. After 4Q-2023, Excel will jump to 1Q-2024. Dash can be any character.

Razzy

Board Regular
Joined
Jul 24, 2020
Messages
61
Office Version
365
Platform
Windows
Solved:

VBS
Code:
cscript script.vbs "%~dp0\Makro.xlsm"
 

Watch MrExcel Video

Forum statistics

Threads
1,102,565
Messages
5,487,588
Members
407,605
Latest member
PACULA

This Week's Hot Topics

Top