Our IT department is in the process of update our PCs from XP to Windows 7 (I know, we’re a bit late, and we’re upgrading to still be out of date). One of the things we do very often is edit batch files within Notepad++ and then execute them with a keyboard shortcut using NppExec. The exact script that we were using on XP (shown below) still runs on Windows 7, but ended up running without Delayed Expansion being turned on (it is already turned on for every individual computer at the system level). We have thousands of batch files, so we didn’t really want to have to go through each one and add setlocal enabledelayedexpansion to each one.
The text in my npes_saved.txt is as follows:
We’re using NppExec 0.5.3 (again, a bit behind, but given that we were still on XP that shouldn’t be too surprising).
After posting over on SourceForge I was able to figure out what we needed to change the last line to this:
NPP_RUN cmd /V:ON /C “$(FULL_CURRENT_PATH)”
This fixed the batch file issue (though I still don’t understand why it was an issue in the first place), but now my powershell commands are running into a similar issue (note that the powershell commands are being called from within the batch with the powershell -f “test.ps1” command).
Previously we had IT go around to each computer in our department and execute the setexecutionpolicy remotesigned command as an admin to allow powershell to run for everyone, but now when I try to run a powershell script from within a batch from Notepad++ I get the following error:
File “test.ps1” cannot be loaded because running scripts is disabled on this system. For more information, see about_Execution_Policies at http:\go.microsoft.com/fwlink/?LinkID=135170
I do not get this error if I just double click the batch from Explorer.
Any suggestions on how to get powershell working (without having to go through and change the commands to be powershell -ExecutionPolicy Unrestricted -File “test.ps1” in all of my batch files) would be greatly appreciated.