Search found 5 matches

by Erzesel
12 Oct 2019 04:27
Forum: DOS Batch Forum
Topic: Powershell2/bat hybrid?
Replies: 25
Views: 19694

Re: Powershell2/bat hybrid?

This is a pretty old thread, but I found an error in the parameter passing to the iex-Script: <# : batch portion :echo off (for %%I in ("%~f0" %*) do @echo:%%~I) | ^ powershell -noprofile "$argv = $input|?{$_}; iex (${%~f0} | out-string)" pause goto :EOF : end batch / begin powershell #> "Result:" $...
by Erzesel
27 Aug 2019 07:34
Forum: DOS Batch Forum
Topic: SCRIPT help. for syntex problem
Replies: 4
Views: 1067

Re: SCRIPT help. for syntex problem

Your Code makes absolutely no sense. you are using Batch variables in Syntax of delayed Expansion (!myVar!) without enabling this syntax by: setlocal enableDelayedExpansion Outside of command blocks, this is not necessary. the specification of the variable with %myVar% is sufficient.] set rc=1 if %r...
by Erzesel
27 Aug 2019 04:26
Forum: DOS Batch Forum
Topic: "bat" file keeps closing after executing
Replies: 5
Views: 1087

Re: "bat" file keeps closing after executing

... why wouldn't my bat file work for your system? Did I do something wrong in my code, Many of the commands inserted into your batch may be syntactically correct. But my system is running stable for years as I keep it clean in my way. Your batch deletes a lot of possibly system-relevant files and ...
by Erzesel
25 Aug 2019 17:40
Forum: DOS Batch Forum
Topic: "bat" file keeps closing after executing
Replies: 5
Views: 1087

Re: "bat" file keeps closing after executing

right at the beginning: You're using a lot of quota characters that are not standard Batch. Only " and ' are valid. In for-loops you can still use a BackQuote `. Other quotes are not allowed. This should work: setlocal enabledelayedexpansion FOR /F "TOKENS=2* DELIMS=:" %%i IN ('TASKLIST /FI "USERNAM...
by Erzesel
25 Aug 2019 03:45
Forum: DOS Batch Forum
Topic: testing the existence of restricted Subfolder without Admin
Replies: 1
Views: 883

testing the existence of restricted Subfolder without Admin

I had to check the existence of a subfolder in all user profiles. Usually i do this with admin rights via if exist "folder path"... Of course, this does not work without admin rights. ...but! To my surprise, I can however without admin: (call;>"restrictedPath\testSubFolder\nul")&&echo Folder exist||...