Search found 6 matches
- 06 Jul 2021 19:54
- Forum: DOS Batch Forum
- Topic: Execute UNC path containing literal %, in command line mode
- Replies: 15
- Views: 13784
Re: Execute UNC path containing literal %, in command line mode
... can't work, because the expansion of my_percent is done before the set statement is executed. What part can't work? I agree that %my_percent% expands before the "set" takes effect, and that's essential. If events happened in the other order, the implementation would be executing a batch file ha...
- 05 Jul 2021 21:04
- Forum: DOS Batch Forum
- Topic: Execute UNC path containing literal %, in command line mode
- Replies: 15
- Views: 13784
Re: Execute UNC path containing literal %, in command line mode
That passed every test I had written. Thank you. I see that an environment variable named "#path" will disrupt this. While the environment and the batch file name are not hostile, I see two ways to achieve robustness against that: Before calling CreateProcessA(), simulate percent expansion on cmd_li...
- 04 Jul 2021 17:35
- Forum: DOS Batch Forum
- Topic: Execute UNC path containing literal %, in command line mode
- Replies: 15
- Views: 13784
Re: Execute UNC path containing literal %, in command line mode
That is a nice technique. However, that enables delayed expansion inside the batch file, not just for the command line. Just like I don't control the batch file name, I don't control whether the batch file is compatible with delayed expansion. Is there a variant that allows the batch file to start w...
- 04 Jul 2021 07:32
- Forum: DOS Batch Forum
- Topic: Execute UNC path containing literal %, in command line mode
- Replies: 15
- Views: 13784
Re: Execute UNC path containing literal %, in command line mode
All else being equal, I prefer a solution that complies with the CreateProcessA() specification. It says, "To run a batch file, you must start the command interpreter; set lpApplicationName to cmd.exe and set lpCommandLine to the following arguments: /c plus the name of the batch file." That implies...
- 04 Jul 2021 05:10
- Forum: DOS Batch Forum
- Topic: Execute UNC path containing literal %, in command line mode
- Replies: 15
- Views: 13784
Re: Execute UNC path containing literal %, in command line mode
No. I found Perl convenient, but here's an equivalent batch file: :: Quoted FAILS: no way to suppress percent expansion (Phase 1) cmd /c ""c:\subdir\foo %%Path%%bar.bat"" :: Unquoted w/ volume specification WORKS. cmd /c "c:\subdir\foo^ ^%%Path^%%bar.bat" :: Unquoted w/ UNC, w/o special first byte F...
- 03 Jul 2021 20:52
- Forum: DOS Batch Forum
- Topic: Execute UNC path containing literal %, in command line mode
- Replies: 15
- Views: 13784
Execute UNC path containing literal %, in command line mode
Suppose there's a batch file at "\\server\share\foo %Path%bar.bat". That is, the path contains the two percent signs literally. Is there a way to execute this file from command line mode? From what I've tried among techniques from https://www.dostips.com/forum/viewtopic.php?t=9124 and https://www.do...