@@ -878,8 +878,6 @@ def _create_batch_scripts_initial(self):
878878rem remove some potential last \
879879if "%WINPYWORKDIR1:~-1%"=="\" set WINPYWORKDIR1=%WINPYWORKDIR1:~0,-1%
880880
881- rem 2024-09-22 pythonify
882- rem FOR /F "delims=" %%i IN ('cscript /nologo "%~dp0WinpythonIni.vbs"') DO set winpythontoexec=%%i
883881FOR /F "delims=" %%i IN ('""%WINPYDIR%\python.exe" "%~dp0WinpythonIni.py""') DO set winpythontoexec=%%i
884882
885883%winpythontoexec%set winpythontoexec=
@@ -904,71 +902,6 @@ def _create_batch_scripts_initial(self):
904902 do_changes = changes ,
905903 )
906904
907- self .create_batch_script (
908- "Noshell.vbs" ,
909- r"""
910- 'from http://superuser.com/questions/140047/how-to-run-a-batch-file-without-launching-a-command-window/390129
911- If WScript.Arguments.Count >= 1 Then
912- ReDim arr(WScript.Arguments.Count-1)
913- For i = 0 To WScript.Arguments.Count-1
914- Arg = WScript.Arguments(i)
915- If InStr(Arg, " ") > 0 or InStr(Arg, "&") > 0 Then Arg = chr(34) & Arg & chr(34)
916- arr(i) = Arg
917- Next
918-
919- RunCmd = Join(arr)
920- CreateObject("Wscript.Shell").Run RunCmd, 0 , True
921- End If
922- """ ,
923- )
924-
925- self .create_batch_script (
926- "WinPythonIni.vbs" ,
927- r"""
928- Set colArgs = WScript.Arguments
929- If colArgs.Count> 0 Then
930- Filename=colArgs(0)
931- else
932- Filename="..\settings\winpython.ini"
933- end if
934- my_lines = Split(GetFile(FileName) & vbNewLine , vbNewLine )
935- segment = "environment"
936- txt=""
937- Set objWSH = CreateObject("WScript.Shell")
938- For each l in my_lines
939- if left(l, 1)="[" then
940- segment=split(mid(l, 2, 999) & "]","]")(0)
941- ElseIf left(l, 1) <> "#" and instr(l, "=")>0 then
942- data = Split(l & "=", "=")
943- if segment="debug" and trim(data(0))="state" then data(0)= "WINPYDEBUG"
944- if segment="environment" or segment= "debug" then
945- txt= txt & "set " & rtrim(data(0)) & "=" & translate(ltrim(data(1))) & "&& "
946- objWSH.Environment("PROCESS").Item(rtrim(data(0))) = translate(ltrim(data(1)))
947- end if
948- if segment="debug" and trim(data(0))="state" then txt= txt & "set WINPYDEBUG=" & trim(data(1)) & "&&"
949- End If
950- Next
951- wscript.echo txt
952-
953-
954- Function GetFile(ByVal FileName)
955- Set FS = CreateObject("Scripting.FileSystemObject")
956- If Left(FileName,3)="..\" then FileName = FS.GetParentFolderName(FS.GetParentFolderName(Wscript.ScriptFullName)) & mid(FileName,3,9999)
957- If Left(FileName,3)=".\" then FileName = FS.GetParentFolderName(FS.GetParentFolderName(Wscript.ScriptFullName)) & mid(FileName,3,9999)
958- On Error Resume Next
959- GetFile = FS.OpenTextFile(FileName).ReadAll
960- End Function
961-
962- Function translate(line)
963- set dos = objWSH.Environment("PROCESS")
964- tab = Split(line & "%", "%")
965- for i = 1 to Ubound(tab) step 2
966- if tab(i)& "" <> "" and dos.Item(tab(i)) & "" <> "" then tab(i) = dos.Item(tab(i))
967- next
968- translate = Join(tab, "")
969- end function
970- """ ,
971- )
972905
973906 self .create_batch_script (
974907 "WinPythonIni.py" , # Replaces winpython.vbs
@@ -1017,7 +950,7 @@ def main():
1017950
1018951 print(txt)
1019952 # later_version:
1020- # p = subprocess.Popen(["start", "cmd", "/k", "set"], shell = True) # Needs to be shell since start isn't an executable, its a shell cmd
953+ # p = subprocess.Popen(["start", "cmd", "/k", "set"], shell = True)
1021954 # p.wait() # I can wait until finished (although it too finishes after start finishes)
1022955
1023956if __name__ == "__main__":
0 commit comments