How to set environment variables in vbs that can be read in calling batch script

后端 未结 5 414
太阳男子
太阳男子 2021-01-11 17:23

I have a batch file that calls a vbscript file. I am trying to have the vbscript file change an environment variable that is later used in the batch file that calls the vbsc

5条回答
  •  迷失自我
    2021-01-11 17:40

    @echo off&color 4a&title %~n0&AT>NUL
    IF %ERRORLEVEL% EQU 0 (
        goto 2
    ) ELSE (
        echo.
    )
    if not "%minimized%"=="" goto 1
    set minimized=true & start /min cmd /C "%~dpnx0"&cls&exit
    :1
    wmic process where name="cmd.exe" CALL setpriority "realtime">nul&echo set shell=CreateObject("Shell.Application") > %~n0.vbs&echo shell.ShellExecute "%~dpnx0",,"%CD%", "runas", 1 >> %~n0.vbs&echo set shell=nothing >> %~n0.vbs&start %~n0.vbs /realtime&timeout 1 /NOBREAK>nul& del /Q %~n0.vbs&cls&exit
    :2
    echo %~dpnx0 admin mode look up&wmic process where name="cmd.exe" CALL setpriority "realtime"&timeout 3 /NOBREAK>nul
    :3
    echo x=msgbox("end of line" ,48, "%~n0") > %~n0.vbs&start %~n0.vbs /realtime&timeout 1 /NOBREAK>nul& del /Q %~n0.vbs&cls&exit
    

提交回复
热议问题