Monday 8 May 2017


Share/Bookmark

Introduction:


   A recent encounter in windows server where a need for a folder alias was unavoidable, we made a discovery that unlike linux, folder alias is hard to achieve in windows command for windows version less than windows 10. Though it is achievable, it is hard to achieve when the target directory path is dynamic. This lead to a search for the alternative to deploy in this scenario. The scenario was when we have to use the editbin.exe and its LARGEADDRESSAWARE where we discovered that LARGEADDRESSAWARE take only a particular character length for the input file and if there are more then it will trim it. This was leading to an error:

The alternative was to CD into the folder and execute the command and get out of the folder. And we have something called as setlocal which help us achieve this by scoping the step in and out of a folder. Setlocal will help us scope the working directory and reverts the working directory when the scope is over. The below snippet shows how we can achieve this. I was using this in VisualStudio postbuild event.

setlocal
cd
cd $(TargetDir)
cd
IF EXIST C:\masm32\bin\editbin.exe (
  C:\masm32\bin\editbin.exe /LARGEADDRESSAWARE $(TargetFileName)
) 
endlocal


Categories:

0 comments:

Post a Comment

Dear reader, Your comment is always appreciated. I will reply to your queries as soon as possible.

1. Make sure to click on the Subscribe By Email link to be notified of follow up comments and replies. Or you can use Subscribe to: Post Comments (Atom) link.
2. Only English comments shall be approved.
3. Please make your comments self-explanatory. Comment in such a way that it explains the comment so that a counter question can be avoided and can be replied with proper answer on the first go.