Execute filename as a comand

Discussion forum for all Windows batch related topics.

Moderator: DosItHelp

Post Reply
Message
Author
miskox
Posts: 610
Joined: 28 Jun 2010 03:46

Execute filename as a comand

#1 Post by miskox » 27 Aug 2024 04:45

I was bored.

set computername.cmd :

Code: Select all

@%~n0&pause&exit /b
Saso

aGerman
Expert
Posts: 4674
Joined: 22 Jan 2010 18:01
Location: Germany

Re: Execute filename as a comand

#2 Post by aGerman » 27 Aug 2024 09:29

Fortunately you have to use %~n0 in your example. Similarly, it's already been the source for headaches of a lot of people whenever they named the script file the same as any command used in the code :lol:

Steffen

Post Reply