Jump to content

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


LazyBoy

Recommended Posts

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.

Link to comment
Share on other sites


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

Link to comment
Share on other sites

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
Link to comment
Share on other sites

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"?

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

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