Search found 135 matches
- 13 Jul 2020 03:35
- Forum: DOS Batch Forum
- Topic: Figuring out which computer is being used at two different locations
- Replies: 12
- Views: 8807
Re: Figuring out which computer is being used at two different locations
You can also define an asset tag in the BIOS - for example "Remote" - and check for the existence of that asset tag using a WMI query. Or: right before starting your script, connect some random USB stick to this machine that has volume label "Remote" and check for the existence of that (wmic volume ...
- 17 May 2020 04:06
- Forum: DOS Batch Forum
- Topic: Debugging / syntax checksing tools for batch
- Replies: 27
- Views: 22756
Re: Debugging / syntax checksing tools for batch
EDIT:
Never mind; you solved it already ..
Never mind; you solved it already ..
- 16 May 2020 06:10
- Forum: DOS Batch Forum
- Topic: Debugging / syntax checksing tools for batch
- Replies: 27
- Views: 22756
Re: Debugging / syntax checksing tools for batch
So, if you replace this line:
Code: Select all
IF /I NOT "%DoGame:~0,1%"=="Y" Echo %time% Not installing games >>C:\%USERDOMAIN%.PostInstall.Log 2>&1
Code: Select all
echo 123
pause
- 15 May 2020 06:15
- Forum: DOS Batch Forum
- Topic: Debugging / syntax checksing tools for batch
- Replies: 27
- Views: 22756
Re: Debugging / syntax checksing tools for batch
This is what I do: - run script with @echo on - On strategic places add code similar to this: PAUSE Start For-Loop1 The PAUSE command will ignore the "Start For-Loop1" part, but it will be shown on the screen, so you know where you are. And more important: it limts the amount of output at a time, ma...
- 11 May 2020 09:17
- Forum: DOS Batch Forum
- Topic: able to run functions from another script?
- Replies: 4
- Views: 4675
Re: able to run functions from another script?
And yet another suggestion: MAIN.cmd @echo off setlocal set RESULT= call Maths :SUM 1 2 echo SUM RESULT = %RETURN% set RESULT= call Maths :MULTIPLY 1 2 echo MULTIPLY RESULT = %RETURN% MATHS.cmd @echo off setlocal set ALLPARMS=%* set ROUTINE=%1 call set PassParms=%%ALLPARMS:%ROUTINE%=%% call %ROUTINE...
- 09 May 2020 18:39
- Forum: DOS Batch Forum
- Topic: Powershell comment
- Replies: 7
- Views: 6050
Re: Powershell comment
"Plan B" (or C?):
Notes:
- Get-Service without the trailing S
- The & should be inside the scriptblock
- I doubt if scriptblocks are even supported from a CMD prompt.
Code: Select all
(
echo Get-Service
echo #this is a comment
echo ls
) | powershell -command -
- Get-Service without the trailing S
- The & should be inside the scriptblock
- I doubt if scriptblocks are even supported from a CMD prompt.
- 02 May 2020 16:53
- Forum: DOS Batch Forum
- Topic: Reg Query For Loop and Reg Add failure
- Replies: 2
- Views: 3769
Re: Reg Query For Loop and Reg Add failure
Next time, please put your output and code between code tags (use the </> button ) That out of the way: Try your code with echo REG ADD .. instead of REG ADD ... to see what's going on. The issue is that it is returning the same result 3 times over for each key with "S/N: That will be caused by the ...
- 29 Apr 2020 19:04
- Forum: DOS Batch Forum
- Topic: Can SET be filled by a command?
- Replies: 7
- Views: 8088
Re: Can SET be filled by a command?
Something like this? (not tetsed)
Code: Select all
setlocal enabledelayedexpansion
for %%x in (%__CD__%*) do set LIST=!LIST! "%%x"
echo LIST = %LIST%
- 29 Apr 2020 18:54
- Forum: DOS Batch Forum
- Topic: file path with changing folder name
- Replies: 2
- Views: 3766
Re: file path with changing folder name
a new folder is created everyday with previous business day (t-1) as the folder name. [...] Here is an example of what the path to the folder would look like: C:\Users\UserA\Ad_Hoc\27Feb2020\Folder_A\File_A If you could convince the person or system that creates these folders to use a date format l...
- 29 Apr 2020 18:48
- Forum: DOS Batch Forum
- Topic: Get IP from MAC adress?!
- Replies: 6
- Views: 5779
- 29 Apr 2020 18:43
- Forum: DOS Batch Forum
- Topic: Why does this work from a command line but not from a batch file
- Replies: 6
- Views: 5887
Re: Why does this work from a command line but not from a batch file
You have a space character after set AppPath=%UserPath%\Applications and multiple spaces after set SRC=%cd:~0,2% Try it with: set "AppPath=%UserPath%\Applications" set "SRC=%cd:~0,2%" FWIW: My advice: organize per application instead of per system part. Makes it better readable and replacing applica...
- 25 Apr 2020 13:48
- Forum: DOS Batch Forum
- Topic: Get IP from MAC adress?!
- Replies: 6
- Views: 5779
Re: Get IP from MAC adress?!
This is what I use to connect an off-line NAS to a non-reserved DHCP address. The intersting part for your case is the following line: for /f "usebackq" %%x in (`arp -a ^| findstr /i "%MAC%"`) do set IP=%%x .. but in case you want to use it for something similar as I did (waking up NAS, getting IP-a...
- 17 Apr 2020 14:08
- Forum: DOS Batch Forum
- Topic: Run CMD as Network service account and execute commands without interaction
- Replies: 2
- Views: 3886
Re: Run CMD as Network service account and execute commands without interaction
Use a scheduled task?
- 06 Apr 2020 14:27
- Forum: DOS Batch Forum
- Topic: Windows Batch - Print line file containing exclamation mark
- Replies: 6
- Views: 7284
Re: Windows Batch - Print line file containing exclamation mark
Try it without the ENABLEDELAYEDEXPANSION as that uses ! for variables (like %): @echo off setlocal for /F "usebackq delims=" %%A in ("test_file.txt") do ( call :ACTION "%%A" ) endlocal exit /b %ERRORLEVEL% :ACTION echo. This line is: [%~1] goto :EOF Result: This line is: [TEST != TEST] Note: I also...
- 17 Mar 2020 08:01
- Forum: DOS Batch Forum
- Topic: close all open folders in file explorer
- Replies: 1
- Views: 3244
Re: close all open folders in file explorer
What have you tried yourself? And where did that go wrong? If you have Launch folder windows in a separate process enabled: taskkill.exe /im explorer.exe If you have that setting disbaled : taskkill.exe /im explorer.exe /F & explorer.exe The second command could also be used in the first case, but t...