@@ -878,8 +878,6 @@ def _create_batch_scripts_initial(self):
878
878
rem remove some potential last \
879
879
if "%WINPYWORKDIR1:~-1%"=="\" set WINPYWORKDIR1=%WINPYWORKDIR1:~0,-1%
880
880
881
- rem 2024-09-22 pythonify
882
- rem FOR /F "delims=" %%i IN ('cscript /nologo "%~dp0WinpythonIni.vbs"') DO set winpythontoexec=%%i
883
881
FOR /F "delims=" %%i IN ('""%WINPYDIR%\python.exe" "%~dp0WinpythonIni.py""') DO set winpythontoexec=%%i
884
882
885
883
%winpythontoexec%set winpythontoexec=
@@ -904,71 +902,6 @@ def _create_batch_scripts_initial(self):
904
902
do_changes = changes ,
905
903
)
906
904
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
- )
972
905
973
906
self .create_batch_script (
974
907
"WinPythonIni.py" , # Replaces winpython.vbs
@@ -1017,7 +950,7 @@ def main():
1017
950
1018
951
print(txt)
1019
952
# 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)
1021
954
# p.wait() # I can wait until finished (although it too finishes after start finishes)
1022
955
1023
956
if __name__ == "__main__":
0 commit comments