Jump to content

[Question] Is there an environment variable for "current folder&q


Recommended Posts

Posted

This is the batch file I use to replace notepad with notepad2.

copy %systemdrive%\notepad.exe %systemroot%\system32\dllcache
copy %systemdrive%\notepad.exe %systemroot%\system32\
copy %systemdrive%\notepad.exe %systemroot%\

As you can see, this batch file will not work unless I first copy notepad.exe to the C: drive. I put notepad2 with the batch file, so if I can just have batch file copy notepad.exe from the same folder (I put them together), that would save me a lot of trouble.


Posted

basically you want to copy your notepad2.exe which would be found in

%programfiles%\notepad2\notepad2.exe

to do this you'd start with

copy %programfiles\notepad2\notepad2.exe %windir%\system32\dllcache\notepad.exe

copy %programfiles\notepad2\notepad2.exe %windir%\system32\notepad.exe

copy %programfiles\notepad2\notepad2.exe %windir%\notepad.exe

Posted (edited)

It's called "." but you don't need it. If the batch file is placed in the same directory as the notepad file then

copy notepad.exe %systemroot%\system32\dllcache
copy notepad.exe %systemroot%\system32\
copy notepad.exe %systemroot%\

is enough to do it. With no paths, current directory is implied, and in this case the current directory also contains the notepad.exe, so it should work.

Edited by LLXX
Posted
It's called "." but you don't need it. If the batch file is placed in the same directory as the notepad file then

copy notepad.exe %systemroot%\system32\dllcache
copy notepad.exe %systemroot%\system32\
copy notepad.exe %systemroot%\

is enough to do it. With no paths, current directory is implied, and in this case the current directory also contains the notepad.exe, so it should work.

Doh! You're right. I totally forgot about it being implied... :P

Just to make sure though, the variable is "." so it would be ".\notepad.exe" for "'currentfolder'\notepad.exe"?

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...